Graph Theory

Kőnig's Theorem: Matchings and Vertex Covers in Bipartite Graphs

In any bipartite graph, the largest set of disjoint edges you can pick and the smallest set of vertices that touches every edge are exactly equal in size — a perfect balance between a packing problem and a covering problem that has no right to be so clean. Kőnig's Theorem states that for a finite bipartite graph G, the maximum size of a matching equals the minimum size of a vertex cover: ν(G) = τ(G).

This min–max identity, proved by Dénes Kőnig in 1931 (with an independent contribution by Jenő Egerváry the same year), is the combinatorial ancestor of linear-programming duality and max-flow min-cut. It fails the instant you leave bipartite territory — the triangle K₃ already breaks it — which is precisely what makes it a theorem about two-colorability rather than a triviality.

  • FieldCombinatorics / Graph theory
  • First provedDénes Kőnig, 1931 (Egerváry, weighted, same year)
  • Key hypothesisG is bipartite and finite
  • Statementν(G) = τ(G): max matching = min vertex cover
  • Proof techniqueAugmenting paths / alternating reachability (constructive)
  • Generalizes toLP duality, max-flow min-cut, Dilworth's theorem

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

The precise statement: a packing equals a covering

Let G = (V, E) be a finite bipartite graph, meaning V splits into two independent sets X and Y so every edge has one endpoint in each. Define:

  • A matching ME is a set of edges no two of which share a vertex. Its maximum size is the matching number ν(G).
  • A vertex cover CV is a set of vertices such that every edge has at least one endpoint in C. Its minimum size is the cover number τ(G).

Kőnig's Theorem (1931). If G is bipartite, then ν(G) = τ(G).

One direction is free: any vertex cover must include at least one endpoint of each of the ν disjoint matching edges, and those endpoints are distinct, so τ ≥ ν for every graph. The content of the theorem is the reverse inequality τ ≤ ν, which is exactly what bipartiteness buys you. The two extremal objects are not just equal in size — the proof exhibits a cover of size ν built from a maximum matching.

The picture: alternating paths and a tight bottleneck

Think of a matching as a set of "assignments" — workers X paired with jobs Y. A vertex cover is a set of "guards" you post so that every possible assignment edge is watched by a guard. Kőnig says the cheapest guarding costs exactly as much as the richest assignment.

The mechanism is the alternating path: given a matching M, a path that alternates between non-matching and matching edges. If such a path starts and ends at unmatched vertices, it is augmenting — flipping matched and unmatched edges along it increases the matching by one. A matching is maximum precisely when no augmenting path exists (Berge's lemma). At that stalling point, the vertices reachable by alternating paths from the unmatched X-vertices carve the graph into a tight structure. The "boundary" of this reachable region — the bottleneck the alternating search runs into — is exactly a minimum vertex cover of size ν. The equality is really a statement that the obstruction to a bigger matching is a small cover.

The key idea of the proof: build the cover from the matching

Take a maximum matching M, of size ν. Let UX be the M-unmatched vertices in X. Let Z be the set of all vertices reachable from U by alternating paths (non-matching edge from X, matching edge from Y, repeat). Now define the cover

C = (X \ Z) ∪ (YZ).

Three facts do all the work. (1) C covers every edge: an edge from XZ to Y\Z is impossible, because that Y-vertex would then be reachable and hence in Z. (2) Every vertex of C is matched — no unmatched X-vertex sits in X\Z (they are all in UZ), and every YZ vertex is matched (an unmatched reachable Y-vertex would give an augmenting path, contradicting maximality). (3) No matching edge has both endpoints in C. Hence |C| ≤ |M| = ν, giving τ ≤ ν. Combined with the trivial ν ≤ τ, equality follows. The argument is fully constructive — it is the augmenting-path / Hopcroft–Karp algorithm in disguise.

A worked example (and the deficiency version)

Take X = {x₁, x₂, x₃}, Y = {y₁, y₂, y₃} with edges x₁–y₁, x₁–y₂, x₂–y₁, x₂–y₂, x₃–y₃. Here x₁ and x₂ both connect only to {y₁, y₂}. A maximum matching is {x₁–y₁, x₂–y₂, x₃–y₃}? Check: that is a valid matching of size 3 — so ν = 3 and the whole graph is coverable by, say, {y₁, y₂, x₃}, of size 3 = τ. Good.

Now delete edge x₃–y₃, isolating nothing but shrinking reach: edges are just the four among {x₁,x₂}×{y₁,y₂}, plus x₃ has no edges. Then ν = 2 (match x₁–y₁, x₂–y₂). A cover of size 2 is {y₁, y₂}, so τ = 2. Kőnig holds. Hall's connection: Kőnig implies Hall's Marriage Theorem — a perfect matching saturating X exists iff |N(S)| ≥ |S| for all SX. The deficiency form gives ν = |X| − maxₛ (|S| − |N(S)|), showing the matching shortfall is governed by the worst Hall-violating set.

Why bipartiteness is essential: the triangle counterexample

Drop bipartiteness and the theorem collapses immediately. In the triangle K₃, any matching uses at most one edge, so ν = 1. But covering all three edges needs at least two vertices — one vertex covers only the two edges at it, leaving the opposite edge uncovered — so τ = 2. Thus ν = 1 < 2 = τ; the gap is exactly the presence of an odd cycle.

This is not an accident: a graph is bipartite if and only if it has no odd cycle (Kőnig, 1936), and odd cycles are precisely the local structures that force τ > ν. The right generalizations restore equality by other means:

  • LP duality / total unimodularity: the bipartite incidence matrix is totally unimodular, so the matching LP has an integral optimum matching its dual cover LP — Kőnig is integral LP duality.
  • Max-flow min-cut: orient XY, add source/sink with unit capacities; a max flow is a max matching and a min cut is a min cover.
  • General graphs: replaced by the Tutte–Berge formula and the (harder) Edmonds blossom algorithm.

Why it matters: the wellspring of min–max combinatorics

Kőnig's Theorem is a min–max theorem: it certifies optimality by pairing a solution (a matching) with a proof of its optimality (an equal-size cover). That template — a good characterization giving both a witness and a co-witness — is the beating heart of combinatorial optimization and of the complexity class NP ∩ co-NP.

  • Algorithms: Hopcroft–Karp finds a maximum bipartite matching (and hence a minimum cover) in O(EV) time; the Hungarian algorithm solves weighted assignment via the Kőnig–Egerváry duality.
  • Descendants: Menger's theorem (vertex-disjoint paths = min separator), Dilworth's theorem (longest antichain = min chain cover — provable directly from Kőnig), Hall's theorem, and the whole polymatroid / total-dual-integrality edifice.
  • Applications: job assignment and scheduling, register allocation, image segmentation (min-cut), rook placements on chessboards with forbidden squares, and Latin-square completion.

In short, Kőnig's 1931 identity is the small, perfect crystal from which linear-programming duality and network flows were later grown.

Four dual parameters and how they relate in general graphs versus bipartite graphs. ν = max matching, τ = min vertex cover, α = max independent set, ρ = min edge cover. Gallai's identities α + τ = n and (for graphs with no isolated vertices) ν + ρ = n hold for ALL graphs; Kőnig's equalities hold only in bipartite graphs.
RelationGeneral graphBipartite graphWhy
ν vs τν ≤ τ (can be strict)ν = τ (Kőnig)Weak duality always; equality needs bipartiteness
α vs ρα ≤ ρ (can be strict)α = ρ (Kőnig–Gallai)Complement of the ν = τ statement via Gallai
ν + ρ= n (no isolated vertices)= nGallai identity — holds for all graphs
α + τ= n= nGallai identity — a cover's complement is independent
Example K₃ν = 1, τ = 2not bipartiteOdd triangle: one edge matched, need 2 vertices to cover

Frequently asked questions

Why does Kőnig's Theorem fail for non-bipartite graphs?

Odd cycles create a gap between ν and τ. In the triangle K₃, a matching can use only one of the three edges (ν = 1), but you need two vertices to touch all three edges (τ = 2). Since a graph is bipartite exactly when it has no odd cycle, odd cycles are the precise obstruction, and for general graphs you only get the weak inequality ν ≤ τ.

What is the difference between Kőnig's Theorem and Hall's Marriage Theorem?

They are equivalent for bipartite graphs but answer different questions. Hall's theorem gives a necessary-and-sufficient condition (|N(S)| ≥ |S| for all S ⊆ X) for a matching that saturates X. Kőnig's theorem gives the exact value of the maximum matching, ν = τ, whether or not a perfect matching exists. Each is easily derived from the other; the deficiency form of Kőnig contains Hall as a special case.

Is the proof constructive, and does it give an algorithm?

Yes. The proof builds a minimum vertex cover directly from a maximum matching using alternating-path reachability, and this is exactly what the augmenting-path algorithm computes. Hopcroft–Karp finds a maximum bipartite matching in O(E√V) time, and reading off the reachable set Z yields the certifying minimum cover in linear extra time.

How is Kőnig's Theorem related to linear-programming duality?

The vertex-edge incidence matrix of a bipartite graph is totally unimodular, so the matching linear program and its dual vertex-cover linear program both have integral optima. Strong LP duality then forces the integral max matching to equal the integral min cover. So Kőnig is the integral shadow of LP duality — and, via max-flow min-cut, of network-flow duality too.

Does the theorem hold for infinite bipartite graphs?

Not in general as stated; naive versions fail because ν and τ can both be infinite or a maximum need not be attained. The correct infinite analogue is the Aharoni–Berger–Ziv theorem (and earlier Aharoni's proof of the infinite Kőnig duality), which restores a matching/cover duality under careful set-theoretic formulations. For finite graphs the statement is unconditional.

What are α and ρ, and how do they fit in via Gallai's identities?

α(G) is the maximum independent set and ρ(G) the minimum edge cover. Gallai's identities say α + τ = n always, and ν + ρ = n for graphs with no isolated vertices. Combining these with Kőnig's ν = τ gives α = ρ in bipartite graphs — the complementary Kőnig–Gallai theorem. So all four parameters lock together in the bipartite case.