
Finding communities based on propagating labels
Source:R/community.R
label.propagation.community.Rdlabel.propagation.community() was renamed to cluster_label_prop() to create a more
consistent API.
Usage
label.propagation.community(
graph,
weights = NULL,
...,
mode = c("out", "in", "all"),
initial = NULL,
fixed = NULL
)Arguments
- graph
The input graph. Note that the algorithm was originally defined for undirected graphs. You are advised to set ‘mode’ to
allif you pass a directed graph here to treat it as undirected.- weights
The weights of the edges. It must be a positive numeric vector,
NULLorNA. If it isNULLand the input graph has a ‘weight’ edge attribute, then that attribute will be used. IfNULLand no such attribute is present, then the edges will have equal weights. Set this toNAif 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.- ...
These dots are for future extensions and must be empty.
- mode
Logical, whether to consider edge directions for the label propagation, and if so, in which direction the labels should propagate. Ignored for undirected graphs. "all" means to ignore edge directions (even in directed graphs). "out" means to propagate labels along the natural direction of the edges. "in" means to propagate labels backwards (i.e. from head to tail).
- initial
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.- fixed
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.
Related documentation in the C library
community_label_propagation(), vcount(), edges(), get_eids(), ecount()