Finding communities based on propagating labelsSource:
This is a fast, nearly linear time algorithm for detecting community structure in networks. In works by labeling the vertices with unique labels and then updating the labels by majority voting in the neighborhood of the vertex.
The input graph, should be undirected to make sense.
The weights of the edges. It must be a positive numeric vector,
NA. If it is
NULLand the input graph has a ‘weight’ edge attribute, then that attribute will be used. If
NULLand no such attribute is present, then the edges will have equal weights. Set this to
NAif 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.
The initial state. If
NULL, every vertex will have a different label at the beginning. Otherwise it must be a vector with an entry for each vertex. Non-negative values denote different labels, negative entries denote vertices without labels.
Logical vector denoting which labels are fixed. Of course this makes sense only if you provided an initial state, otherwise this element will be ignored. Also note that vertices without labels cannot be fixed.
cluster_label_prop() returns a
communities() object, please see the
manual page for details.
This function implements the community detection method described in: Raghavan, U.N. and Albert, R. and Kumara, S.: Near linear time algorithm to detect community structures in large-scale networks. Phys Rev E 76, 036106. (2007). This version extends the original method by the ability to take edge weights into consideration and also by allowing some labels to be fixed.
From the abstract of the paper: “In our algorithm every node is initialized with a unique label and at every step each node adopts the label that most of its neighbors currently have. In this iterative process densely connected groups of nodes form a consensus on a unique label to form communities.”
Raghavan, U.N. and Albert, R. and Kumara, S.: Near linear time algorithm to detect community structures in large-scale networks. Phys Rev E 76, 036106. (2007)
communities() for extracting the actual results.
cluster_leiden() for other community detection methods.
Tamas Nepusz email@example.com for the C implementation, Gabor Csardi firstname.lastname@example.org for this manual page.
g <- sample_gnp(10, 5 / 10) %du% sample_gnp(9, 5 / 9) g <- add_edges(g, c(1, 12)) cluster_label_prop(g) #> IGRAPH clustering label propagation, groups: 2, mod: 0.47 #> + groups: #> $`1` #>  1 2 3 4 5 6 7 8 9 10 #> #> $`2` #>  11 12 13 14 15 16 17 18 19 #>