Bipartite graphs

A graph is bipartite only and only if it is bicolorable. So, to decide if it is bipartite, we con try to bicorate it with a DFS: bool dfs(int node, int color) { if(color[node] != 0) {     if(color[node] == color) {         return true; }     else {         return false; }   }  color[node] = color; for(int i = 0; i < degree[nod]; ++i) {     if(!dfs(adj[node][i], -color)) {         return false; }         }   return true; }