Discrete Optimization Lecture Notes 4
Discrete Optimization Lecture Notes 4
Topics: Matching theory (I): Tutte-Berge formula, Edmonds’s Blossom Shrinking algorithm
Book: Chapters 5.1, 5.2
Matching
A matching in an undirected graph G = (V, E) is a set M of edges that pairwise have no endpoint
in common. A node is covered by M if it is an endpoint of one of the edges in M . A node that
is not covered is called exposed. If there are no exposed nodes, M is called perfect. The maximum
size of a matching is denoted ν(G) and the number of nodes exposed by a maximum matching M is
def(G) = |V | − 2|M | = |V | − 2ν(G).
The main goals of this lecture are to find maximum matchings algorithmically and to give good
optimality certificates.
Bipartite case
Given a bipartite graph G = (V, E) with bipartition V = V1 ∪ V2 , there is a simple min-max formula for
the maximum size of a matching. Recall that a subset S ⊆ V is a cover if every edge has at least one
endpoint in S. The minimum size of a cover is denoted τ (G).
Theorem 1 (König-Egerváry). Let G be bipartite. Then the maximum size of a matching equals the
minimum size of a cover: ν(G) = τ (G).
This theorem (Thm 3.14 in the book) follows directly from the max-flow min-cut theorem as we
have seen previously. Using the algorithms of Ford-Fulkerson, we can solve maximum size matching and
minimum size cover on bipartite graphs. This relies on the fact that there is always an integral optimum
flow (for integral capacities and demands). See CH 3.3
Augmenting paths
A path P is called M -alternating if it alternately traverses edges in M and in E \ M . If P is a simple
path with two endpoints that are both M -exposed, then P is called M -augmenting. Switching M on the
path P , that is, replacing M by the symmetric difference of M ∆E(P ), we obtain a new matching that is
larger than M by exactly one edge. The following fact is fundamental.
Theorem 2 (Berge, Thm 5.1). There is an M -augmenting path if and only if M is not maximum.
The key ingredient in proving this theorem, and also in proving others, is the following observation:
Let M and N be two matchings in G = (V, E). Then the components of the graph H = (V, M ∆N ) are
M -alternating paths and even length M -alternating circuits. In particular, if |N | > |M |, then H has an
odd length path component that is M -augmenting.
Tutte-Berge formula
Although the minimum size of a cover is still an upper bound for the maximum size of a matching in
general graphs, equality may not hold (consider for example an odd circuit). The right min-max relation
in the general case is
Theorem 3 (Tutte-Berge, Thm 5.2).
1
ν(G) = min (|V | − oc(G − S) + |S|) .
S⊆V 2
Here G − S denotes the graph obtained from G by deleting the nodes in S. For a graph H, oc(H)
denotes the number of components of H that have an odd number of nodes.
The theorem can be equivalently stated as: def(G) equals the maximum of oc(G − S) − |S| over all
subsets S of V .
1
The inequality ν(G) ≤ (|V | − oc(G − S) + |S|)/2 is easy to see. The harder inequality can be shown
via induction on the number of nodes. Here is a sketch:
Proof. For the graph on 1 node, the base case, take S = ∅. For the induction step, consider three cases:
Case I. There is an essential node. That is, a node a covered by every optimal matching (so ν(G − a) =
ν(G) − 1). Take S 0 ⊆ V \ {a} such that ν(G − a) = (|V \ {v}| − oc(G − v − S 0 ) + |S 0 |)/2, which
exists by induction. Now take S := S ∪ {a}. Then
Case II. There is no essential node and for an optimal matching there is only one exposed node. In this
case, take S = ∅.
Case III. There is no essential node and for an optimal matching there are at least two exposed nodes.
We show that this case does not occur!
Take, for contradiction, an optimal matching M and two M -exposed nodes a, b. We choose such M ,
a, b subject to the secondary contraint that the distance between a and b ia as small as possible. Let
P be a shortest path between a and b. Then P has length at least 2 (why?) so we can pick a node
c 6∈ {a, b} on P . By our secondary constraint, c is covered by M . Since we are not in case I, there
is an optimal matching N for which c is exposed. Now consider the component of c in (V, M ∆N ).
This must be an even length path Q. Set M 0 := M ∆E(Q). Then M 0 is an optimal matching for
which c is exposed. Since also a or b must be M 0 -exposed (why?), this contradicts our secondary
constraint.
Shrinking
Let G = (V, E) be a graph, C an odd circuit and F ⊆ E. We define:
• V /C := V \ V (C) ∪ {C} (replace the nodes in C by one pseudonode called C)
• F/C :=
{e ∈ E : e has no endpoint in C} ∪ {vC : v not on C and there is an edge from v to a node in C}
• G/C := (V /C, E/C)
So G/C is obtained from G by contracting the circuit C to a pseudonode called C. No loops are formed
and parallel edges are removed. In the book, the somewhat confusing notation G × C is used instead of
G/C. We will only apply this in the case where C is an alternating circuit of odd length. The following
lemma is key.
Lemma 1. Let C be an M -blossom. Let C have length 2k + 1. Then
• M/C is a matching of size |M | − k in G/C
• any matching N 0 in G/C gives a matching of size |N 0 | + k in G (by adding edges on the circuit C)
• M/C is a maximum matching in G/C if and only if M is a maximum matching in G
The lemma shows that if C is an M -blossom, then the problem of augmenting M reduces to augmenting
M/C in the smaller graph G/C. Since any shortest M -alternating path between two exposed nodes is an
M -augmenting path, or determines an M -blossom, we obtain an algorithm for finding a maximum size
matching.
A more refined algorithm is presented in terms of M -alternating forests.
2
M-alternating forests
A subgraph T = (V 0 , F ) of G is called an M -alternating tree if it is a tree, contains exactly one M -exposed
node (called the root), and every simple path from the root to a leaf of T is an even length M -alternating
path.
A spanning forest T = (V, F ) of G is called an M -alternating forest if each component is either a
single matching edge (plus its endpoints), or an M -alternating tree. Given an M -alternating forest T , we
denote:
A := {v ∈ V : there is an odd-length path in T from v to an exposed node},
B := {v ∈ V : there is an even-length path in T from v to an exposed node},
V \ (A ∪ B) = {v ∈ V : v is in a component of T consisting of a single matching edge}.
The nodes in A are called odd, the nodes in B are called even, and the remaining nodes are neither even
nor odd. Note that B contains all exposed nodes.
Exercises
CH 5.1: 5.2, 5.5, 5.7, 5.9 (possibly without using L5.5)
CH 5.2: 5.14, Extra1, Extra2
3
Extra1
Let M be a matching in G and let C be an odd M -alternating circuit. Suppose that C has an M -exposed
node. Show that M is a maximum matching if and only if M/C is a maximum matching in G/C.
Hint: how does an M -augmenting path give an M/C-augmenting path?
Extra2
Let C be an M -blossom. Use the previous exercise to show that M is a maximum matching if M/C is a
maximum matching in G/C. Hint: swap M on the stem of the M -flower to expose a node of C.