Finding community structure by multi-level optimization of modularity
Source:R/community.R
cluster_louvain.Rd
This function implements the multi-level modularity optimization algorithm for finding community structure, see references below. It is based on the modularity measure and a hierarchical approach.
Arguments
- graph
The input graph.
- weights
The weights of the edges. It must be a positive numeric vector,
NULL
orNA
. If it isNULL
and the input graph has a ‘weight’ edge attribute, then that attribute will be used. IfNULL
and no such attribute is present, then the edges will have equal weights. Set this toNA
if the graph was a ‘weight’ edge attribute, but you don't want to use it for community detection. A larger edge weight means a stronger connection for this function.- resolution
Optional resolution parameter that allows the user to adjust the resolution parameter of the modularity function that the algorithm uses internally. Lower values typically yield fewer, larger clusters. The original definition of modularity is recovered when the resolution parameter is set to 1.
Value
cluster_louvain()
returns a communities()
object, please see the communities()
manual page for details.
Details
This function implements the multi-level modularity optimization algorithm for finding community structure, see VD Blondel, J-L Guillaume, R Lambiotte and E Lefebvre: Fast unfolding of community hierarchies in large networks, https://arxiv.org/abs/0803.0476 for the details.
It is based on the modularity measure and a hierarchical 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. Since igraph 1.3, vertices are processed in a random order.
This function was contributed by Tom Gregorovic.
References
Vincent D. Blondel, Jean-Loup Guillaume, Renaud Lambiotte, Etienne Lefebvre: Fast unfolding of communities in large networks. J. Stat. Mech. (2008) P10008
See also
See communities()
for extracting the membership,
modularity scores, etc. from the results.
Other community detection algorithms: cluster_walktrap()
,
cluster_spinglass()
,
cluster_leading_eigen()
,
cluster_edge_betweenness()
,
cluster_fast_greedy()
,
cluster_label_prop()
cluster_leiden()
Community detection
as_membership()
,
cluster_edge_betweenness()
,
cluster_fast_greedy()
,
cluster_fluid_communities()
,
cluster_infomap()
,
cluster_label_prop()
,
cluster_leading_eigen()
,
cluster_leiden()
,
cluster_optimal()
,
cluster_spinglass()
,
cluster_walktrap()
,
compare()
,
groups()
,
make_clusters()
,
modularity.igraph()
,
plot_dendrogram()
,
split_join_distance()
Author
Tom Gregorovic, Tamas Nepusz ntamas@gmail.com
Examples
# This is so simple that we will have only one level
g <- make_full_graph(5) %du% make_full_graph(5) %du% make_full_graph(5)
g <- add_edges(g, c(1, 6, 1, 11, 6, 11))
cluster_louvain(g)
#> IGRAPH clustering multi level, groups: 3, mod: 0.58
#> + groups:
#> $`1`
#> [1] 1 2 3 4 5
#>
#> $`2`
#> [1] 6 7 8 9 10
#>
#> $`3`
#> [1] 11 12 13 14 15
#>