Warning

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

is_bipartite_node_set

is_bipartite_node_set(G, nodes)[source]

Returns True if nodes and G/nodes are a bipartition of G.

Parameters:
  • G (NetworkX graph) –
  • nodes (list or container) – Check if nodes are a one of a bipartite set.

Examples

>>> from networkx.algorithms import bipartite
>>> G = nx.path_graph(4)
>>> X = set([1,3])
>>> bipartite.is_bipartite_node_set(G,X)
True

Notes

For connected graphs the bipartite sets are unique. This function handles disconnected graphs.