NetworkX

Previous topic

is_bipartite

Next topic

sets

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.

Notes

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

Examples

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