I have been trying to understand the bipartite graph. To my understanding it is a graph G which can be divided into two subgraphs U and V.So that intersection of U and V is
The following is a BFS approach to check whether the graph is bipartite.
c = 0x and set x.class = cys be the nodes obtained by BFS
c = 1-cy in ys set y.class = cy in ys has a neighbour z with z.class == c then the graph is not bipartiteThis assumes that the graph is a single connected component -- if it is not, simply do this procedure for each component.