[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] computing community attributes
From: |
Sam Steingold |
Subject: |
[igraph] computing community attributes |
Date: |
Fri, 17 Aug 2012 12:16:06 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
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] computing community attributes,
Sam Steingold <=