Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.community.quality.performance

performance(*args, **kw)[source]

Returns the performance of a partition.

The performance of a partition is the ratio of the number of intra-community edges plus inter-community non-edges with the total number of potential edges.

Parameters:
  • G (NetworkX graph) – A simple graph (directed or undirected).
  • 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:

The performance of the partition, as defined above.

Return type:

float

Raises:

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

References

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