igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] RE: your spinglass.community function in the R igraph libra


From: Tamas Nepusz
Subject: Re: [igraph] RE: your spinglass.community function in the R igraph library
Date: Sat, 6 Feb 2010 23:36:44 +0000

> I looked at other igraph functions for finding communities (eg. 
> fastgreedy.community(), walktrap.community()) and found that they don't seem 
> to return any information on which community each vertex is a member of - or 
> at least, I couldn't figure out how to infer that information from their 
> output - is there a way to do that?
Yes, there is. These functions return a dendrogram, which encodes how 
individual vertices were progressively merged into larger communities until 
there was only a single community left. Usually you need some kind of a 
"quality function" to determine where to "cut" the dendrogram; in other words, 
where to stop the merging process. Some of the community detection routines 
provide this information in a so-called modularity vector.

For instance, fastgreedy.community will return a named list with two members:

cl <- fastgreedy.community(g)

In this case, cl$merges will contain the merge matrix (i.e. the dendrogram), 
and cl$modularity will contain the modularity of the partitions after each 
merge. By selecting the maximal value from cl$modularity, you can obtain how 
many merges you have to take in order to obtain the partition with the highest 
modularity. Then you can use community.to.membership() to extract the 
membership vector you need from the merge matrix.

For more information about community.to.membership(), see this page:

http://igraph.sourceforge.net/doc/R/community.structure.html

-- 
Tamas





reply via email to

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