Testing if a graph is bipartite