0

For this project on network analysis, I'm studying communities between characters in Game Of Thrones using igraph and a handful of algorithms (walktrap, spinglass, etc). If all the labels are turned on, the plot becomes way too crowded. Is there a way to scale nodes and their labels based on the weight of their edges?

The only documentation I've been able to find is for the global resizing of labels, regardless of node importance. These are pretty simple communities -- Nodes are the names of characters, Edges are the source and target characters and the weight of each relationship.

# Walktrap algorithm
book5_walktrap = walktrap.community(book5, weights=E(book5)$weight)
plot(book5_walktrap, book5, vertex.label = NA, vertex.size=2, main="Walktrap")
# Or vertex.label = nodes$Label

Ideally, I'd like for only the most prominent characters of each community to be blown up.

with labels

christopherhlee
  • 89
  • 2
  • 4
  • 13
  • 1
    [This](https://kateto.net/networks-r-igraph) is a very thorough network plotting tutorial that I refer to a lot. To get much more detailed help, you'll need to make a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). How are you measuring importance? – camille Apr 20 '19 at 19:52

1 Answers1

0

You can set the size of the label using vertex.label.cex. You do not provide data nor how you are measuring importance, so I illustrate with the karate data set from igraphdata. I simply use a scaled version of degree as the importance of a node.

library(igraph)
library(igraphdata)

data(karate)
karate_walktrap = walktrap.community(karate)
set.seed(1234)
plot(karate_walktrap, karate, vertex.size=2, 
    main="Walktrap", vertex.label.cex=round(degree(karate)/5))

Karate with various sizes for node labels

G5W
  • 36,531
  • 10
  • 47
  • 80