public BipartitionDetection(Graph G){
this.G = G;
visited = new boolean[G.V()];
for(int v = 0; v < G.V(); v ++)
if(!visited[v]) {
colors = new int[G.V()];
for(int i = 0 ; i < colors.length; i ++)
colors[i] = -1;
if(!dfs(v, 0)){
isBipartited = false;
break;
}
}
}