def is_bipartite(G):
 try:
  color(G)
  return True
 except nx.NetworkXError:
  return False

def is_bipartite ( G ) : try : color ( G ) return True except nx . NetworkXError : return False
returns true if graph g is bipartite .