How to find if a graph is Bipartite?
Answers
Answered by
0
Check if a given graph is Bipartite using DFS
Use a color[] array which stores 0 or 1 for every node which denotes opposite colors.
Call the function DFS from any node.
If the node u has not been visited previously, then assign !color[v] to color[u] and call DFS again to visit nodes connected to u.
hope it will help you
Similar questions