networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
asyn_lpa_communities(G, weight=None, seed=None)

The asynchronous label propagation algorithm is described in . The algorithm is probabilistic and the found communities may vary on different executions.

The algorithm proceeds as follows. After initializing each node with a unique label, the algorithm repeatedly sets the label of a node to be the label that appears most frequently among that nodes neighbors. The algorithm halts when each node has the label that appears most frequently among its neighbors. The algorithm is asynchronous because each node is updated without waiting for updates on the remaining nodes.

This generalized version of the algorithm in accepts edge weights.

Notes

Edge weight attributes must be numerical.

Parameters

G : Graph
weight : string

The edge attribute representing the weight of an edge. If None, each edge is assumed to have weight one. In this algorithm, the weight of an edge is used in determining the frequency with which a label appears among the neighbors of a node: a higher weight means the label appears more often.

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> .

Returns

communities : iterable

Iterable of communities given as sets of nodes.

Returns communities in G as detected by asynchronous label propagation.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/community/label_propagation.py#14
type: <class 'function'>
Commit: