|
From: | Gábor Csárdi |
Subject: | Re: [igraph] compute and assign attributes to graphs in a list |
Date: | Mon, 11 Mar 2013 10:32:50 -0400 |
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 thisfor (i in 1:length(graphs)) V(graphs[[i]])$size <- degree(graphs[[i]])works is clear to me, but why thatfor (g in graphs) V(g)$size <- degree(g)
doesn't isn't (in print(graphs) the size attribute is missing).
my config :igraph 0.6-3R 2.15.1
[Prev in Thread] | Current Thread | [Next in Thread] |