igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Choosing between different methods of detecting communities


From: Gábor Csárdi
Subject: Re: [igraph] Choosing between different methods of detecting communities
Date: Tue, 9 Oct 2012 10:02:13 -0400

On Tue, Oct 9, 2012 at 6:51 AM, Roey Angel <address@hidden> 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

[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]