check undirected graph is bipartite