I have a graph with some vertex attributes:

IGRAPH UNW- 9105 1110486 -- 
+ attr: name (v/c), count (v/n), weight (e/n)

and I have a community structure on it.
how do I compute, say, the vector of sums of counts (vertex attribute)
of communities?

so far I only came up with

sapply(1:length(community.ml), function (i) sum(vertices[vertices$vertex %in% 
attr(which(membership(community.ml) == i),"names"),]$count))

where `vertices' is a data frame which was used to create the graph in

graph.data.frame(edges.all, vertices = vertices)

I suspect that there is a better way.
what is it?

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://dhimmi.com http://mideasttruth.com
http://thereligionofpeace.com http://openvotingconsortium.org
If you misspell "milk" 4 times, you can get "beer".

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to