multilevel.community (graph, weights = NULL)
weight
edge attribute, then this is used
by default. Supply NA
here if the graph has a weight
edge attribute, but you want to ignore it.multilevel.community
returns a communities
object, please see the communities
manual page for
details.It is based on the modularity measure and a hierarchial approach. Initially, each vertex is assigned to a community on its own. In every step, vertices are re-assigned to communities in a local, greedy way: each vertex is moved to the community with which it achieves the highest contribution to modularity. When no vertices can be reassigned, each community is considered a vertex on its own, and the process starts again with the merged communities. The process stops when there is only a single vertex left or when the modularity cannot be increased any more in a step. This function was contributed by Tom Gregorovic.
communities
for extracting the membership,
modularity scores, etc. from the results.
Other community detection algorithms:
walktrap.community
,
spinglass.community
,
leading.eigenvector.community
,
edge.betweenness.community
,
fastgreedy.community
,
label.propagation.community
# This is so simple that we will have only one level
g <- graph.full(5) %du% graph.full(5) %du% graph.full(5)
g <- add.edges(g, c(1,6, 1,11, 6, 11))
multilevel.community(g)
Run the code above in your browser using DataLab