7.11.5.1. networkx.algorithms.community.quality.coverage

networkx.algorithms.community.quality.coverage(*args, **kw)[source]

Returns the coverage of a partition.

The coverage of a partition is the ratio of the number of intra-community edges to the total number of edges in the graph.

Parameters:

G : NetworkX graph

partition : sequence

Partition of the nodes of G, represented as a sequence of sets of nodes. Each block of the partition represents a community.

Returns:

float

The coverage of the partition, as defined above.

Raises:

NetworkXError

If partition is not a valid partition of the nodes of G.

Notes

If G is a multigraph, the multiplicity of edges is counted.

References

[R577]Santo Fortunato. “Community Detection in Graphs”. Physical Reports, Volume 486, Issue 3–5 pp. 75–174 <http://arxiv.org/abs/0906.0612>