You are on page 1of 4

Discrete Optimization (WI4227) 2018–2019

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

(|V | − oc(G − S) + |S|)/2 = (2 + |V \ {v}| − oc(G − v − S 0 ) + |S 0 |)/2 = ν(G − v) + 1 = ν(G).

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.

Edmonds’ Blossom Shrinking algorithm


Finding a maximum size matching can be reduced to iteratively finding M -augmenting paths. In bipartite
graphs, finding an M -augmenting path reduces to finding a shortest path in a directed graph. However, in
general graphs odd circuits form a major obstacle as a shortest M -alternating path between two exposed
nodes may run into an odd circuit. The breakthrough idea came from Edmonds: shrink odd circuits.

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.

Matching augmentation routine


Input: a matching M in G.
We keep a graph G0 = (V 0 , E 0 ) obtained from G by shrinking odd circuits, a matching M 0 in G0 and
an M 0 -alternating forest (V 0 , F ) in G0 . Denote the even and odd nodes in (V, F ) by B and A. During the
algorithm, all pseudonodes will be in B.
Initialize: Set G0 := G, M 0 := M , F := M . So B is the set of M -exposed nodes.
Iteration: While such an edge exists, find an edge e = uv in G0 with u ∈ B and v ∈ V 0 \ A. There are a
few cases:
1. If v ∈ V 0 \ (A ∪ B), then add e and the edge f ∈ M 0 covering v to F to obtain a larger M 0 -alternating
forest.
2. If v ∈ B and u and v are in different components of the forest, then we obtain an M 0 -augmenting
path P between the two roots. Augment M 0 and expand pseudonodes to obtain a matching in G
larger than M . STOP
3. If v ∈ B and u and v are in the same component of the forest, we obtain an odd M -alternating
circuit C (an M -blossom in fact).
Set G0 := G0 /C, M 0 := M 0 /C, F : F/C. Observe that the new pseudenode C is indeed an even
node in the new alternating forest (V 0 /C, F/C).
If no such edge e exists, the matching M is already optimal. Output the set A as an optimality certificate
as in the Tutte-Berge formula. STOP.
Proof. We prove correctness of the algorithm. In each M -alternating tree, the number of even nodes is
one more than the number of odd nodes. Hence, in an M -alternating forest, |B| − |A| equals the number
of exposed nodes.
When there is no more edge e between B and V \ A in the algorithm, the set A has the following
properties:
i. |B| − |A| equals the number of M 0 -exposed nodes (as noted above)
ii. In G0 − A, every node in B is a single-node component (hence odd).
It follows that the set A is a certificate of optimality for M 0 in G0 as in the Tutte-Berge formula.
Since pseudonodes (obtained from shrunk odd circuits) are always nodes in B, expanding them does
not change the number of components. It also does not change their parity because expanding an odd
circuit adds an even number of nodes to a component. Since the number of M -exposed nodes in G equals
the number of M -exposed nodes in G, the same set A serves as an optimality certificate for matching M in
G. This proves the correctness of the algorithm and at the same time proves the Tutte-Berge formula.

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.

You might also like