is_bipartite_node_set#
- is_bipartite_node_set(G, nodes)[source]#
Returns True if nodes and G/nodes are a bipartition of G.
- Parameters:
- GNetworkX graph
- nodes: list or container
Check if nodes are a one of a bipartite set.
Notes
An exception is raised if the input nodes are not distinct, because in this case some bipartite algorithms will yield incorrect results. 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