fastgreedy.community {igraph} | R Documentation |
This function tries to find dense subgraph, also called communities in graphs via directly optimizing a modularity score.
fastgreedy.community(graph, merges=TRUE, modularity=TRUE, weights=E(graph)$weight)
graph |
The input graph |
merges |
Logical scalar, whether to return the merge matrix. |
modularity |
Logcal scalar, whether to return a vector containing the modularity after each merge. |
weights |
If not |
This function implements the fast greedy modularity optimization algorithm for finding community structure, see A Clauset, MEJ Newman, C Moore: Finding community structure in very large networks, http://www.arxiv.org/abs/cond-mat/0408187 for the details.
A named list with the following members:
merges |
A matrix with two column, this represents a dendogram
and contains all the merges the algorithm performed. Each line is
one merge and it is given by the ids of the two communities
merged. The community ids are integer numbers starting from zero
and the communities between zero and the number of vertices
( |
modularity |
A numeric vector containing the modularity value of the community structure after performing every merge. |
Tamas Nepusz ntamas@rmki.kfki.hu and Gabor Csardi csardi@rmki.kfki.hu for the R interface.
A Clauset, MEJ Newman, C Moore: Finding community structure in very large networks, http://www.arxiv.org/abs/cond-mat/0408187
walktrap.community
,
spinglass.community
,
leading.eigenvector.community
,
edge.betweenness.community
g <- graph.full(5) %du% graph.full(5) %du% graph.full(5) g <- add.edges(g, c(0,5, 0,10, 5, 10)) fastgreedy.community(g) # The highest value of modularity is before performing the last two # merges. So this network naturally has three communities.