NetworkX

Previous topic

networkx.is_bipartite

Next topic

networkx.bipartite_color

networkx.bipartite_sets

bipartite_sets(G)

Returns bipartite node sets of graph G.

Raises an exception if the graph is not bipartite.

Parameters:

G : NetworkX graph

Returns:

(X,Y) : two-tuple of sets

One set of nodes for each part of the bipartite graph.

See also

bipartite_color

Examples

>>> G=nx.path_graph(4)
>>> X,Y=nx.bipartite_sets(G)
>>> print X
set([0, 2])
>>> print Y
set([1, 3])