On Tue, Oct 9, 2012 at 6:51 AM, Roey Angel <[email protected]> wrote: > Hi Tamas, > Thanks again. This is exactly my prob. I know about membership() but that > produces an an numeric not a list. Even coercing it with as.list() doesn't > do the trick and the function doesn't work. > The problem is to convert membership to a list of communities containing > each it's respective nodes, but I can't figure out how to do that. I'm just > not familiar enough with these objects to even understand where exactly the > node names are stored.
You don't need to be familiar with the internal representation(s) of these object. In fact, quite the contrary, you should not use the internals, because they might change. Just use the API. E.g. to get the list you want, just use the communities() function. See more at ?communities. E.g. g <- graph.ring(10) fc <- fastgreedy.community(g) membership(fc) # [1] 2 2 2 2 1 1 1 1 3 3 communities(fc) # $`1` # [1] 5 6 7 8 # # $`2` # [1] 1 2 3 4 # # $`3` # [1] 9 10 Gabor [...] _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
