networkx 2.8.2 Pypi GitHub Homepage
Other Docs
_generate_communities(degree_seq, community_sizes, mu, max_iters, seed)

degree_seq is the degree sequence that must be met by the graph.

community_sizes is the community size distribution that must be met by the generated list of sets.

mu is a float in the interval [0, 1] indicating the fraction of intra-community edges incident to each node.

max_iters is the number of times to try to add a node to a community. This must be greater than the length of degree_seq , otherwise this function will always fail. If the number of iterations exceeds this value, ~networkx.exception.ExceededMaxIterations is raised.

seed

seed

The communities returned by this are sets of integers in the set {0, ..., n - 1}, where n is the length of degree_seq .

Returns a list of sets, each of which represents a community.

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/generators/community.py#750
type: <class 'function'>
Commit: