Warning

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

networkx.algorithms.community.community_utils.is_partition

is_partition(G, communities)[source]

Returns True if communities is a partition of the nodes of G.

A partition of a universe set is a family of pairwise disjoint sets whose union is the entire universe set.

Parameters
  • G (NetworkX graph.)

  • communities (list or iterable of sets of nodes) – If not a list, the iterable is converted internally to a list. If it is an iterator it is exhausted.