Bipartite Graphs and Matchings

A bipartite graph is a graph whose vertices split into two disjoint sets with edges only crossing between them. A matching is a set of edges sharing no endpoints. Key result: König's Theorem and Hall's Marriage Theorem completely characterize when perfect matchings exist and relate maximum matchings to minimum vertex covers. Applies to assignment problems, scheduling, and network flows. Foundations laid by Frobenius (1917), König, and Hall (1935).

A graph is bipartite if its vertex set partitions into two parts and such that every edge has one endpoint in and one in . A matching is a set of pairwise non-adjacent edges; intuitively, it pairs up vertices without overlap. Bipartite matching theory is central to combinatorial optimization because it admits efficient algorithms (unlike general matching, which is harder) and a beautiful duality: the size of a maximum matching equals the size of a minimum vertex cover. The surprising fact is that a purely existential question — "can we match everyone?" — reduces to a clean, checkable condition (Hall's condition) that fails the moment any subset of one side has too few neighbors.

The Core Insight

Bipartite structure forbids odd cycles, which makes "augmenting paths" behave perfectly. A matching is maximum if and only if no augmenting path exists, and in bipartite graphs these paths can be found greedily. This turns matching into a problem of local search along alternating paths, and the obstruction to a perfect matching is always a single "deficient" set, never something subtle.

Formal Statement

Bipartite Graph

A graph is bipartite with bipartition if

1
⟳directly encode "every edge crosses the partition" as a logical constraint on endpoints.

Here are the two parts (or color classes). The numbers and are the sizes of the sides.

Characterization by Odd Cycles (König 1916)

A graph is bipartite if and only if it contains no cycle of odd length.

2
⟳2-color the graph by BFS parity; a conflict appears exactly when an odd closed walk forces a vertex to need both colors.

Matching, Maximum, Perfect

A matching satisfies: no two edges of share an endpoint.

3
⟳"share no endpoint" is just disjointness of the two-element edge sets.

  • is maximum if no matching has more edges: , where is the matching number.
  • is perfect if every vertex is matched: .
  • A vertex covered by is saturated; otherwise exposed/free.

Vertex Cover and Covering Number

A vertex cover is a set touching every edge:

4
⟳a cover must "hit" each edge, so at least one endpoint lies in .

The minimum size of a vertex cover is .

Hall's Marriage Theorem (1935)

Let be bipartite with parts . There exists a matching saturating iff for every subset ,

5
where is the neighborhood of .
⟳necessity is counting; sufficiency follows by augmenting-path induction or by reducing to König's theorem.

König's Theorem (1931)

In any bipartite graph, the maximum matching number equals the minimum vertex cover number:

6
⟳build a vertex cover of size from an alternating-path reachability argument; weak duality gives always.

Deficiency Version (König–Ore)

The maximum matching size obeys the deficiency formula:

7
⟳the term measures the worst Hall-violating set; subtract this "deficiency" from .

Why It Holds / Derivation

Hall's Theorem via Augmenting Paths

We prove the nontrivial direction: if for all , then can be saturated.

Step 1 — Setup. Let be a maximum matching. Suppose for contradiction some is exposed. We build a set violating Hall's condition. Step 2 — Alternating tree. Grow an alternating path from : edges alternate between non-matching (from to ) and matching (from back to ). Let
8
⟳collect exactly the vertices the alternating search touches on each side.
Step 3 — Structure of reached vertices. Every is matched (else we found an augmenting path from to , contradicting maximality of ), and its match lies in . Hence gives a bijection between and , so
9
⟳every matched pairs to a distinct reachable , and alone is unmatched.
Step 4 — . Any neighbor of some is reachable (extend the alternating path), so ; trivially . Thus , violating Hall's condition — contradiction. Therefore no exposed vertex exists and is saturated.

König's Theorem from a Maximum Matching

Let be a maximum matching. Let be the exposed vertices of . Let be the set of all vertices reachable from by alternating paths. Define

10
⟳take unreachable -vertices plus reachable -vertices — exactly the "blocked" side of each matching edge.

Claim 1 — is a vertex cover. Any edge with : its other end must be in (reachability extends), so . If , then . So every edge is covered. Claim 2 — . No edge of connects to (that would extend reachability), and every vertex of is matched (exposed -vertices are in , hence excluded; exposed -vertices are unreachable). Each matching edge contributes exactly one vertex to . Hence .

Since always (each matching edge needs its own cover vertex) and we exhibited a cover of size , we get .

Philip Hall | 1904–1982

Philip Hall, a British group theorist at Cambridge, proved the Marriage Theorem in 1935 while studying systems of distinct representatives. Though best known for deep contributions to finite group theory (Hall subgroups, the Hall–Higman theorem), his combinatorial result became a cornerstone of matching theory. The evocative "marriage" framing — matching people to acceptable partners — popularized the abstract statement, and the theorem's many equivalent forms (König, Menger, max-flow) reveal it as one face of a single duality principle.

Building Intuition

Picture jobs () and workers (), with an edge meaning "this worker can do this job." A perfect assignment is a perfect matching. Hall's condition says: assignment fails only if some group of jobs collectively can be done by fewer than workers — a genuine bottleneck. König's duality is the accountant's version: the fewest "checkpoints" (vertices) needed to monitor every connection equals the most independent connections you can run simultaneously. The augmenting path is the trick that fixes a suboptimal assignment: find a free job, follow a chain that re-shuffles existing assignments, and end at a free worker — flipping the chain increases the match by one.

An alternating/augmenting path in a bipartite graph. Bold gold edges are in matching M; the dashed path augments it.

<svg viewBox="0 0 460 300" xmlns="http://www.w3.org/2000/svg">
<rect width="460" height="300" fill="#0a0e17"/>
<text x="70" y="30" fill="#e2e8f0" font-size="15" font-family="sans-serif">X</text>
<text x="370" y="30" fill="#e2e8f0" font-size="15" font-family="sans-serif">Y</text>
<!-- X vertices -->
<circle cx="80" cy="70" r="9" fill="#0a0e17" stroke="#94a3b8" stroke-width="2"/>
<circle cx="80" cy="150" r="9" fill="#0a0e17" stroke="#94a3b8" stroke-width="2"/>
<circle cx="80" cy="230" r="9" fill="#0a0e17" stroke="#94a3b8" stroke-width="2"/>
<!-- Y vertices -->
<circle cx="380" cy="70" r="9" fill="#0a0e17" stroke="#94a3b8" stroke-width="2"/>
<circle cx="380" cy="150" r="9" fill="#0a0e17" stroke="#94a3b8" stroke-width="2"/>
<circle cx="380" cy="230" r="9" fill="#0a0e17" stroke="#94a3b8" stroke-width="2"/>
<text x="55" y="75" fill="#e2e8f0" font-size="13" font-family="sans-serif">x1</text>
<text x="55" y="155" fill="#e2e8f0" font-size="13" font-family="sans-serif">x2</text>
<text x="55" y="235" fill="#e2e8f0" font-size="13" font-family="sans-serif">x3</text>
<text x="395" y="75" fill="#e2e8f0" font-size="13" font-family="sans-serif">y1</text>
<text x="395" y="155" fill="#e2e8f0" font-size="13" font-family="sans-serif">y2</text>
<text x="395" y="235" fill="#e2e8f0" font-size="13" font-family="sans-serif">y3</text>
<!-- non-matching edges -->
<line x1="89" y1="73" x2="371" y2="147" stroke="#94a3b8" stroke-width="1.5" stroke-dasharray="5,4"/>
<line x1="89" y1="153" x2="371" y2="227" stroke="#94a3b8" stroke-width="1.5" stroke-dasharray="5,4"/>
<line x1="89" y1="230" x2="371" y2="73" stroke="#94a3b8" stroke-width="1"/>
<!-- matching edges (gold) -->
<line x1="89" y1="150" x2="371" y2="150" stroke="#d4a853" stroke-width="3"/>
<line x1="89" y1="230" x2="371" y2="230" stroke="#d4a853" stroke-width="3"/>
<text x="150" y="285" fill="#d4a853" font-size="12" font-family="sans-serif">gold = matched, dashed = unmatched path edges</text>
<!-- augmenting path label -->
<text x="120" y="55" fill="#e2e8f0" font-size="11" font-family="sans-serif">x1 free → y2 → x2 → y3 → x3 free</text>
</svg>

Worked Examples

Checking Hall's Condition Numerically

Given: Jobs , workers , with capability edges: –{1,2}, –{1}, –{1}. Step 1 — Test small sets. . . Good. Step 2 — Test the suspicious set. Take : , so but . Step 3 — Hall's condition fails. Since , no matching saturates . Step 4 — Maximum matching size. Deficiency . By [7]:
Answer:

Verifying König Duality

Given: Bipartite graph , with edges (a "path-plus" shape). Step 1 — Find a maximum matching. Take . Both -vertices saturated; . Step 2 — Is it maximum? Only 4 vertices; a matching of size 2 is perfect, so . Step 3 — Find a minimum vertex cover. : edge hit by , by , by . Size . No single vertex covers all 3 edges, so . Step 4 — Confirm [6]. . ✓ Answer:

Common Misconceptions

Hall's condition is on , not symmetric. A matching saturating may exist while has exposed vertices (when ). For a perfect matching you also need , and then checking Hall on suffices. Also: König's theorem () holds only for bipartite graphs. In general graphs , and the gap can be real. König fails in general graphs. Take the triangle (odd cycle, not bipartite). Maximum matching has (one edge; the third vertex is left out). But minimum vertex cover needs vertices, since one vertex leaves an uncovered edge. Here , so duality breaks precisely because has an odd cycle.

Connections

Bipartite matching is the combinatorial heart of Max-Flow Min-Cut Theorem: model the matching as a flow network with unit capacities, and an integral max flow equals the maximum matching, while a min cut yields a minimum vertex cover — giving König's theorem as a corollary. It is one instance of Menger's Theorem (vertex-disjoint paths) and of LP duality, since the bipartite matching polytope is integral (the constraint matrix is totally unimodular). The weighted version connects to The Assignment Problem and the Hungarian algorithm, and the structural theory generalizes via Tutte's Theorem for matchings in arbitrary graphs.

Real-World Applications

  1. Job/task assignment: matching workers to tasks they are qualified for (Hungarian algorithm in operations research).
  2. Scheduling and timetabling: assigning courses to rooms/time-slots without conflicts via edge colorings of bipartite graphs (König's edge-coloring theorem: ).
  3. Network routing & switch scheduling: input-output crossbar switches in routers use bipartite matching (e.g., iSLIP algorithm) to pair input ports with output ports each cycle.
  4. Kidney exchange / organ matching: donor–recipient compatibility modeled as matching problems.
  5. Online advertising: matching ad impressions to advertisers (online bipartite matching, RANKING algorithm) under arriving requests.
  6. Image and graph correspondence: matching feature points between two images (computer vision) as a weighted bipartite assignment.
  7. Resource allocation / stable marriage: the Gale–Shapley algorithm produces stable matchings for college admissions and medical residency placement (NRMP).

Historical Development

  • 1912: Frobenius initiates the algebraic study of bipartite structures, examining when a 0–1 matrix has a nonzero permanent (equivalent to a perfect matching).
  • 1916: Dénes König characterizes bipartiteness by the absence of odd cycles, founding graph-theoretic matching.
  • 1917: Frobenius proves the determinant/permanent condition for perfect matchings in bipartite graphs.
  • 1931: König proves the min–max theorem for bipartite graphs (also derived independently by Egerváry in weighted form the same year).
  • 1935: Philip Hall publishes the Marriage Theorem on systems of distinct representatives.
  • 1947: Tutte generalizes to arbitrary graphs with the Tutte–Berge formula's precursor.
  • 1955: Harold Kuhn introduces the Hungarian algorithm for weighted assignment, crediting König and Egerváry.
  • 1965: Jack Edmonds gives a polynomial algorithm for general (non-bipartite) matching via blossoms.
  • 1973: Hopcroft and Karp give an algorithm for maximum bipartite matching, still a benchmark.
  • 1990: Karp, Vazirani & Vazirani analyze online bipartite matching (the RANKING algorithm, competitive ratio ).

Subtleties & Limits

While exact bipartite matching is solved efficiently, several frontiers remain active. Online bipartite matching with stochastic arrivals: closing the gap between known competitive ratios (e.g., beating under various arrival models) is ongoing. Dynamic matching: maintaining a near-maximum matching under edge insertions/deletions with low update time is a major area, with conditional lower bounds. Counting perfect matchings (the permanent) is -hard even for bipartite graphs (Valiant 1979), though approximate counting is possible via the Jerrum–Sinclair–Vigoda MCMC algorithm. Finally, the precise communication and streaming complexity of approximating maximum matching remains incompletely understood.

See Also

Max-Flow Min-Cut Theorem · Menger's Theorem · Tutte's Theorem · The Assignment Problem · Stable Matching and Gale–Shapley · Linear Programming Duality · Edge Coloring · Total Unimodularity

Before this

Where this leads