Warning

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

sets

sets(G)[source]

Returns bipartite node sets of graph G.

Raises an exception if the graph is not bipartite.

Parameters:G (NetworkX graph) –
Returns:(X,Y) – One set of nodes for each part of the bipartite graph.
Return type:two-tuple of sets

Examples

>>> from networkx.algorithms import bipartite
>>> G = nx.path_graph(4)
>>> X, Y = bipartite.sets(G)
>>> list(X)
[0, 2]
>>> list(Y)
[1, 3]

See also

color()