Returns a two-coloring of the graph.
Raises an exception if the graph is not bipartite.
Parameters: | G : NetworkX graph |
---|---|
Returns: | color : dictionary
|
Examples
>>> G=nx.path_graph(4)
>>> c=nx.bipartite_color(G)
>>> print c
{0: 1, 1: 0, 2: 1, 3: 0}