Bipartite Graph
Use two colors.
Adjacent vertices must have different colors.
BFS or DFS can perform the coloring.
A graph is bipartite if and only if it contains no odd-length cycle.
Complexity: O(V+E).
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.