Skip to main content

MA 415G course notes

Section 5.2 Maximum Matching in Graphs

One of the fundamental ideas of applied math is to find ways to effectively pair or match objects or entities. For example, matching problems arise when we want to pair workers with jobs, students with courses, and other situations where paired assignments are required. The mathematical idea that captures this is the concept of a matching in a graph.

Definition 5.2.1.

Given a finite graph \(G\text{,}\) a matching is a set of edges such that no two edges share a common vertex. A maximum matching is a matching that contains the largest possible number of edges. The size of a maximum matching is called the matching number of the graph.

Example 5.2.2.

Let \(K_n\) be the complete graph on \(n\) vertices. Any maximum matching in \(K_n\) has size \(\lfloor n/2 \rfloor\text{,}\) since we can pair up the vertices in pairs, and if there is an odd vertex left over, it cannot be matched.

Checkpoint 5.2.3.

Consider the Petersen graph shown below. Consider the matching given by the edges
\begin{equation*} \{01,34,57,68\}\text{.} \end{equation*}
Is this a maximum matching? If not, find a larger matching. How do you know whether or not a matching is maximum?
Figure 5.2.4. Drawing of the Petersen graph.
The example above shows that there is a difference between "maximal" matchings, i.e., those that cannot be extended to larger matching by adding edges, and "maximum" matchings, which have the largest possible number of edges for any matching in the graph. Finding maximum matchings in graphs is a fundamental problem in graph theory and combinatorial optimization.
Thus, given a graph \(G\text{,}\) we will set our task to find a maximum matching in \(G\text{.}\) This will be the metric we will use to evaluate the "best" matchings -- we will be seeking the matchings that have the largest possible number of edges. Given a matching \(M\) in \(G\text{,}\) we want to try to systematically find a way to produce a larger matching, or to determine that no larger matching exists.

Checkpoint 5.2.5.

Consider the path graph on \(7\) vertices, with vertices labeled \(v_1, v_2, \ldots, v_7\) in order. One possible matching is \(M = \{v_1v_2, v_4v_5\}\text{.}\) This matching has two edges. How can we create a larger matching from this one?

Checkpoint 5.2.6.

Consider the cycle graph \(C_6\) on 6 vertices, with vertices labeled \(v_1, v_2, \ldots, v_6\) in order. One possible matching is \(M = \{v_1v_2, v_4v_5\}\text{.}\) This matching has two edges. How can we create a larger matching from this one?

Definition 5.2.7.

Let \(G\) be a graph and \(M\) a matching in \(G\text{.}\) An augmenting path with respect to \(M\) is a path in \(G\) that starts and ends at vertices not covered by \(M\text{,}\) and alternates between edges not in \(M\) and edges in \(M\text{.}\)

Checkpoint 5.2.8.

Consider again the Petersen graph shown below with the matching given by the edges
\begin{equation*} \{01,34,57,68\}\text{.} \end{equation*}
Show that \((2,7,5,8,6,9)\) is an augmenting path in this matching. What happens if we remove the edges of the matching along this path and add the other edges of the path to the matching?
Figure 5.2.9. Drawing of the Petersen graph.

Proof.

Since the path starts and ends at vertices not covered by \(M\text{,}\) the first and last edges of the path are not in \(M\text{.}\) Thus, there are an odd number of edges in the path, and there is one more edge not in \(M\) than there are edges in \(M\text{.}\) When we remove the edges of \(M\) along the path and add the other edges of the path to the matching, we increase the size of the matching by \(1\text{.}\) What results is a valid matching since no two edges in the new matching share a common vertex; this is because the endpoints of the path are not covered by any edges in the original matching.

Checkpoint 5.2.11.

The following theorem was proven by Claude Berge in 1957.

Proof.

Let’s suppose that \(M\) is a matching in \(G\) and that \(M\) is maximum. We will show that there are no augmenting paths with respect to \(M\text{.}\) Suppose, for the sake of contradiction, that there is an augmenting path \(P\) with respect to \(M\text{.}\) By our lemma, we can create a new matching \(M'\) by removing the edges of \(M\) along the path and adding the other edges of the path to the matching. The new matching \(M'\) has size \(|M| + 1\text{,}\) which contradicts the assumption that \(M\) is maximum. Therefore, there are no augmenting paths with respect to \(M\text{.}\)
Next, we will show that if there are no augmenting paths with respect to a matching \(M\) in \(G\text{,}\) then \(M\) is maximum. We will do this using the technique of proof by contrapositive: we will show that if \(M\) is not maximum, then there exists an augmenting path with respect to \(M\text{.}\) Let \(M'\) be a maximal matching in \(G\text{,}\) and note that \(|M'| > |M|\text{.}\) Consider the symmetric difference \((M \cup M')\setminus (M\cap M')\text{,}\) and consider the subgraph \(H\) of \(G\) containing those edges. In \(H\text{,}\) each vertex has degree \(1\) or \(2\text{,}\) since each vertex is incident to at most one edge from \(M\) and at most one edge from \(M'\text{.}\) Thus, the connected components of \(H\) are paths and cycles, and if they are cycles, the length of the cycle is even, since the edges alternate between those in \(M\) and those in \(M'\text{.}\) The graph \(H\) has more elements of \(M'\) than of \(M\text{,}\) so there must be at least one path component in \(H\) that has more edges from \(M'\) than from \(M\text{.}\) Such a path must start and end with edges from \(M'\text{,}\) and thus starts and ends at vertices not covered by \(M\text{.}\) Therefore, this path is an augmenting path with respect to \(M\text{,}\) and we are done.

Checkpoint 5.2.13.

Checkpoint 5.2.14.

Proof by contrapositive states that if we want to prove that \(P \implies Q\text{,}\) it is sufficient to prove that \(\neg Q \implies \neg P\text{,}\) where \(\neg Q\) is the negation of \(Q\text{.}\) Using the following truth table, explain why this proof technique is valid.
Table 5.2.15. Truth Table
P Q
T T
T F
F T
F F
Berge’s theorem leads to an algorithm for finding maximum matchings in graphs: start with any matching, and repeatedly look for augmenting paths. If an augmenting path is found, use it to create a larger matching. Of course, it is not obvious how to find augmenting paths efficiently, but this can be done and leads to an amazing algorithm called "Edmonds’ blossoming algorithm", which was developed by Jack Edmonds in the early 1960’s: https://en.wikipedia.org/wiki/Blossom_algorithm
There remain many interesting open problems related to matchings in graphs, such as problems about rainbow matchings in edge-colored graphs: https://en.wikipedia.org/wiki/Rainbow_matching