1 Basic Concepts
A matching in a graph G=(V,E) is a set M⊆E of pairwise non-adjacent edges (no two edges in M share an endpoint). A vertex incident to an edge of M is said to be matched (or saturated). A matching of maximum cardinality is called a maximum matching. A matching that saturates every vertex of G is a perfect matching.
An alternating path with respect to a matching M is a path whose edges alternate between M and E∖M. An alternating path whose two endpoints are both unsaturated by M is called an augmenting path.
2 Berge's Theorem
A matching M is a maximum matching if and only if there is no augmenting path with respect to M.
(⇒): If an augmenting path P exists, the symmetric difference M′=M⊕E(P) (exchanging matched and unmatched edges along P) is a matching with ∣M′∣=∣M∣+1, contradicting the maximality of M.(⇐): Suppose M is not maximum, and let M∗ be a maximum matching with ∣M∗∣>∣M∣. Consider H=M⊕M∗. Every vertex of H has degree at most 2 (at most one edge from M and one from M∗), so each connected component of H is a path or an even-length cycle. Since ∣M∗∣>∣M∣, some component has more edges from M∗ than from M. A cycle has equally many edges from each, so this component must be a path. It begins and ends with edges of M∗, meaning both endpoints are unsaturated by M. This path is therefore an augmenting path for M. □
3 Matchings in Bipartite Graphs
A graph G=(V,E) is bipartite if V can be partitioned as V=X⊔Y so that every edge joins a vertex in X to a vertex in Y.
A bipartite graph G=(X⊔Y,E) has a matching that saturates every vertex of X if and only if ∣N(S)∣≥∣S∣ for every S⊆X, where N(S) denotes the neighborhood of S.
(⇒): If a matching M saturates X, then for any S⊆X, the matching pairs the vertices of S with ∣S∣ distinct vertices in Y, so ∣N(S)∣≥∣S∣.(⇐): We prove the contrapositive. Suppose no matching saturates X. Let M be a maximum matching with ∣M∣<∣X∣. Pick an unsaturated vertex u∈X. Let Z be the set of all vertices reachable from u via alternating paths. Set S=Z∩X and T=Z∩Y. Since u∈S and u is unsaturated, u contributes to S. Since there is no augmenting path (Berge's theorem), every vertex in T is matched by M, and its partner under M lies in S (being reachable via the alternating path). Thus ∣T∣=∣S∣−1. Moreover, N(S)⊆T: if some neighbor y of S lay outside T, then y would be reachable from u via an alternating path, placing y in Z∩Y=T, a contradiction. Therefore ∣N(S)∣≤∣T∣=∣S∣−1<∣S∣. □
4 König's Theorem
A vertex cover of G=(V,E) is a set C⊆V such that every edge has at least one endpoint in C.
In a bipartite graph, the size of a maximum matching equals the size of a minimum vertex cover.
For any matching M and vertex cover C, we have ∣C∣≥∣M∣ (each edge of M requires at least one vertex of C to cover it). We show equality is attained. Take a maximum matching M and construct the reachability set Z as in the proof of Hall's theorem. Define C=(X∖Z)∪(Y∩Z). One verifies that ∣C∣=∣M∣ and that C is a vertex cover. □
5 Stable Matchings
Let M be a set of n men and W a set of n women, each with a strict preference ordering over the opposite set. A perfect matching μ is unstable if there exist a man m and a woman w, not paired with each other, such that m prefers w to μ(m) and w prefers m to μ(w). A matching with no such pair is called a stable matching.
The Gale–Shapley algorithm (men-proposing version) terminates in finitely many steps and outputs a stable matching. Moreover, the matching it produces is men-optimal: every man is matched with the best partner he could have in any stable matching.
Termination. Each man proposes to each woman at most once, so the algorithm terminates after at most n2 proposals.Stability. Suppose an unstable pair (m,w) exists. Either m never proposed to w, or he did and was rejected. In the first case, m prefers μ(m) to w (since men propose in order of preference), contradicting the assumption that (m,w) is unstable. In the second case, w was holding a proposal she preferred to m at the time; since a woman's partner can only improve over the course of the algorithm, w prefers μ(w) to m in the final matching — again a contradiction.Men-optimality is established by inductively showing that no man is ever rejected by a woman who could be his partner in some stable matching. □
6 Weighted Matchings