Dear all,
I have lists in which elements are graphs, like :
graphs <- lapply(c(100,1000), graph.atlas)
In order to plot them, I would like to compute sizes of vertices depending on degree, color, labels, etc. Idem with edges and layouts. I have found a way to do that with the apply family, but it is not elegant and I'm not confident about it :
graphs <- lapply(graphs, function(x) {V(x)$size <- degree(x) ; x})
Finally, I've decided to use 'for', but found myself with a problem I don't understand. Why this
for (i in 1:length(graphs)) V(graphs[[i]])$size <- degree(graphs[[i]])
works is clear to me, but why that
for (g in graphs) V(g)$size <- degree(g)
doesn't isn't (in print(graphs) the size attribute is missing).
Thanks a lot for your time and for the great work on igraph !
Yannick
my config :
igraph 0.6-3
R 2.15.1