Bipartite Graph Checker

χ(G) = 2? No odd cycles?

CalculatorsFreeNo Signup
4.2(115 reviews)
All Tools

Loading tool...

About Bipartite Graph Checker

A bipartite graph checker testing if G is 2-colorable (χ=2). Bipartite iff no odd cycles. BFS/DFS 2-coloring in O(n+m). König's theorem: matching = vertex cover for bipartite. Many NP-hard problems become polynomial on bipartite graphs. Client-side.

Bipartite Graph Checker Features

  • Bipartite check
  • 2-coloring
  • Odd cycle
  • König's thm
  • Common graphs
Bipartite: V = A∪B with edges only between A and B. Equivalent: χ(G)=2, no odd cycles. Testable in O(n+m) via BFS 2-coloring. König: ν=τ. Hall: perfect matching iff |N(S)|≥|S|. Many NP-hard problems are polynomial on bipartite.

How to Use

Select graph:

  • Bipartite? Yes/No
  • Partition: A, B sets
  • Odd cycle: If not bipartite

König's Theorems

For bipartite: (1) max matching = min vertex cover (ν=τ). (2) max independent set = min edge cover. (3) Edge coloring: χ'=Δ. These fail for general graphs but hold perfectly for bipartite.

BFS 2-Coloring

Start BFS, alternate colors 0/1 between levels. If any edge connects same-color vertices → odd cycle → not bipartite. O(n+m) time. Works on disconnected graphs by running BFS from each component.

Step-by-Step Instructions

  1. 1Select graph.
  2. 2Run BFS coloring.
  3. 3Check edges.
  4. 4Find partition.
  5. 5Apply König.

Bipartite Graph Checker — Frequently Asked Questions

Why are bipartite graphs important?+

Many problems become easy: matching (Hopcroft-Karp O(m√n)), vertex cover (= matching by König), edge coloring (χ'=Δ by König). Bipartite graphs model two-type relationships: workers-jobs, students-courses.

How to detect odd cycles?+

BFS 2-color attempt. When it fails (edge between same-color vertices), trace back the BFS tree from both endpoints to find the odd cycle. This gives a certificate of non-bipartiteness in O(n+m).

What's a complete bipartite graph?+

K_{m,n}: every vertex in A(size m) connects to every vertex in B(size n). Has mn edges. K_{3,3} is the utilities graph (non-planar). K_{1,n} is a star. K_{n,n} has n! perfect matchings.

Share this tool: