- Published on
Introduction to Graph Theory - Part 8
- Authors

- Name
- Till Heller
Suppose a company needs to assign jobs to applicants. Each applicant is qualified for certain positions, and each position can be filled by at most one person. How do we pair up as many applicants with jobs as possible? Or think of a dance: people want to be paired into couples, but not everyone is willing to dance with everyone else. How many couples can we form?
These are matching problems — and they are among the most elegant and practically important topics in graph theory. In this final part of our introduction, we'll define matchings formally, learn when perfect matchings exist, and see how a clever idea called augmenting paths ties everything together.
Matchings
Let's start with the basic setup. Given a graph, a matching is a set of edges that don't share any vertices — each vertex is "used" at most once.
Definition 40. A matching in a graph is a set of edges such that no two edges in share a vertex.
If a vertex is an endpoint of some edge in , we say that is matched. Otherwise, is free (or unmatched).
Consider the graph , a cycle . The set is a matching — the two edges don't share any vertex. The set is not a matching, because vertex appears in both edges.
There are different notions of "best" for a matching, and it's important to distinguish them.
Definition 41. A matching is maximal if no edge can be added to without violating the matching property. In other words, every edge in shares a vertex with some edge in .
Definition 42. A matching is maximum if there is no matching with more edges. The size of a maximum matching is denoted .
A maximal matching is not necessarily maximum. In the path with vertices , the matching is maximal — we can't add or without conflicting with — but it's not maximum, since has two edges.

The most desirable outcome is when every vertex gets matched.
Definition 43. A perfect matching is a matching that covers every vertex of the graph. That is, every vertex is matched.
A perfect matching can only exist when the number of vertices is even — after all, each edge in the matching accounts for exactly two vertices. But having an even number of vertices is necessary, not sufficient. The path has four vertices and admits a perfect matching , while the star also has four vertices but no perfect matching (the center vertex can be matched to only one of the three leaves, leaving two vertices free).
Observation 9. A perfect matching in a graph on vertices has exactly edges.
Augmenting Paths
How do we find a maximum matching? The key insight is a beautiful structural characterization discovered by Claude Berge in 1957. It revolves around the idea of augmenting paths.
Given a matching , imagine walking through the graph along a path that alternates between edges not in and edges in . If this path starts and ends at free vertices, we can "flip" every edge along the path — replacing the non-matching edges with matching edges and vice versa — to get a matching with one more edge.
Definition 44. Given a matching , an alternating path is a path whose edges alternate between edges in and edges not in .
Definition 45. An augmenting path (with respect to ) is an alternating path that starts and ends at free vertices.
Let's see this in action. Take the path with vertices and matching . The path is an alternating path: the edge is not in , the edge is in , and the edge is not in . Since vertices and are both free, this is an augmenting path. If we flip the edges, we get the new matching — one edge larger than .

This idea leads to one of the most fundamental results in matching theory.
Theorem 10 (Berge, 1957). A matching is maximum if and only if there is no augmenting path with respect to .
Proof. For the "only if" direction: suppose there exists an augmenting path with respect to . The path has one more non-matching edge than matching edge (since both endpoints are free). Flipping all edges along produces a new matching with , so is not maximum.
For the "if" direction: suppose is not maximum, and let be a matching with . Consider the symmetric difference — the set of edges that belong to exactly one of the two matchings. Every vertex has at most one edge from and at most one edge from , so in , every vertex has degree at most . This means is a union of isolated vertices, paths, and even cycles. The even cycles contribute equally to and . Since , there must be at least one path in with more edges from than from . This path starts and ends with edges from , so its endpoints are free with respect to — it is an augmenting path.
Berge's theorem is not just a theoretical characterization — it directly leads to algorithms. To find a maximum matching, start with any matching (even the empty one) and repeatedly search for augmenting paths. Each augmenting path increases the matching by one edge, and by Berge's theorem, we stop exactly when the matching is maximum1.
Hall's Marriage Theorem
Let's now focus on bipartite graphs, where matching theory is especially clean. Recall from Part 3 that a bipartite graph has two groups and with edges only between them. When does a bipartite graph have a matching that covers every vertex in ?
Think of it as a marriage problem: each person in group has a list of acceptable partners in group . Can everyone in be matched? Philip Hall answered this question in 1935 with an elegant necessary and sufficient condition.
For a set , we write for the neighborhood of — the set of all vertices in that are adjacent to at least one vertex in .
Theorem 11 (Hall, 1935). A bipartite graph has a matching that covers every vertex in if and only if for every subset .
The condition is called Hall's condition. It says that every group of vertices in must collectively have at least as many neighbors in — otherwise, there simply aren't enough partners to go around.
The "only if" direction is straightforward: if every vertex in is matched, their partners are distinct vertices in , so . The "if" direction is more involved and can be proved using augmenting paths or by induction on 2.
Let's check Hall's condition on a small example. Consider the bipartite graph with , , and edges . For , we have , so . For , , so . For , , so . Checking all subsets confirms Hall's condition holds, and indeed a matching covering exists: .
As a corollary, we can characterize when a bipartite graph has a perfect matching.
Corollary 2. A bipartite graph with has a perfect matching if and only if for every subset .
Vertex Covers and König's Theorem
There is a deep duality between matchings and a seemingly different concept: vertex covers.
Definition 46. A vertex cover of a graph is a set such that every edge in has at least one endpoint in .
A matching picks edges so that no vertex is used twice. A vertex cover picks vertices so that no edge is missed. These two concepts are naturally opposed: every edge in a matching needs at least one of its endpoints in any vertex cover, so the size of any vertex cover is at least the size of any matching.
Observation 10. For any graph , , where is the size of a maximum matching and is the size of a minimum vertex cover.

In general graphs, this inequality can be strict. But in bipartite graphs, a remarkable theorem by Dénes König tells us that equality always holds.
Theorem 12 (König, 1931). In a bipartite graph, the size of a maximum matching equals the size of a minimum vertex cover: .
König's theorem is one of the jewels of combinatorics. It connects an optimization problem about selecting edges (matching) to one about selecting vertices (cover), and it tells us that in bipartite graphs, these dual problems always have the same answer. The proof can be constructed by starting with a maximum matching and carefully selecting one endpoint from each matched edge to form a minimum vertex cover3.
Beyond Bipartite Graphs
In bipartite graphs, Hall's theorem gives a clean condition for when a perfect matching exists. What about general graphs? The answer is given by a theorem of William Tutte.
For a graph and a set , let denote the number of connected components with an odd number of vertices in the graph obtained by removing .
Theorem 13 (Tutte, 1947). A graph has a perfect matching if and only if for every subset .
Tutte's condition generalizes Hall's condition to non-bipartite graphs. The intuition is that each odd component needs at least one "escape edge" to a vertex in in order to match all its vertices, so there must be enough vertices in to accommodate all odd components.
We state Tutte's theorem here without proof, as the full argument is considerably more technical than Hall's theorem. It remains one of the deepest results in matching theory.
Wrapping Up the Series
With matchings, we've reached the end of this introduction to graph theory. Let's look back at the ground we've covered across all eight parts:
In Part 1, we saw how a puzzle about bridges gave birth to an entire field of mathematics. Part 2 laid the formal foundations with vertices, edges, and degrees. Part 3 introduced the main graph families — complete graphs, paths, cycles, bipartite graphs, trees, and regular graphs. Part 4 taught us how to move through graphs with walks, trails, and paths, and formalized Euler's bridge theorem. Part 5 took a deep dive into trees and their many equivalent characterizations. Part 6 added direction to our edges, opening up the world of digraphs, DAGs, and topological sorting. Part 7 explored graph coloring, from greedy algorithms to the Four Color Theorem. And here in Part 8, we studied matchings and the elegant duality between matchings and vertex covers.
These eight parts only scratch the surface. Graph theory is a vast and active field with connections to computer science, optimization, biology, and many other areas. If you've enjoyed this series, consider exploring some of the more advanced topics on this blog, such as Network Flows or Gallai's Path Conjecture, which build directly on the concepts we've developed here.
Footnotes
For a detailed discussion of algorithms that find augmenting paths efficiently in bipartite graphs, see the article on Algorithms for Maximum Matchings in Bipartite Graphs. ↩
The inductive proof splits into two cases depending on whether Hall's condition holds with strict inequality for all proper subsets of , or whether equality is achieved for some proper subset. ↩
König's theorem is closely related to the max-flow min-cut theorem from network flow theory. In fact, it can be derived as a special case — see the series on Network Flows. ↩