networkx.bipartite_sets
networkx.project
Enter search terms or a module, class or function name.
Returns a two-coloring of the graph.
Raises an exception if the graph is not bipartite.
G : NetworkX graph
color : dictionary
A dictionary keyed by node with a 1 or 0 as data for each node color.
Examples
>>> G=nx.path_graph(4) >>> c=nx.bipartite_color(G) >>> print c {0: 1, 1: 0, 2: 1, 3: 0}