Functions for computing and measuring community structure.
The functions in this class are not imported into the top-level
networkx namespace. You can access these functions by importing
networkx.algorithms.community module, then accessing the
functions as attributes of
community. For example:
>>> import networkx as nx >>> from networkx.algorithms import community >>> G = nx.barbell_graph(5, 1) >>> communities_generator = community.girvan_newman(G) >>> top_level_communities = next(communities_generator) >>> next_level_communities = next(communities_generator) >>> sorted(map(sorted, next_level_communities)) [[0, 1, 2, 3, 4], , [6, 7, 8, 9, 10]]
Functions for computing the Kernighan–Lin bipartition algorithm.
||Partition a graph into two blocks using the Kernighan–Lin algorithm.|
Functions for generating graphs with community structure.
||Returns the LFR benchmark graph for testing community-finding algorithms.|
||Find k-clique communities in graph using the percolation method.|
Asynchronous label propagation algorithms for community detection.
||Returns communities in
Functions for measuring the quality of a partition (into communities).
||Returns the coverage of a partition.|
||Returns the performance of a partition.|
Partitions via centrality measures¶
Functions for computing communities based on centrality notions.
||Finds communities in a graph using the Girvan–Newman method.|