Bipartite Graph
A bipartite graph is a graph whose vertices can be divided into two disjoint sets such that every edge connects vertices from different sets. A standard way to test this is graph coloring with two colors using BFS or DFS. If an edge connects two vertices having the same color, the graph is not bipartite.
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).