Berge's lemma #
A matching M of a graph is maximum when no matching has more edges. An M-augmenting path
is a path between two distinct vertices not covered by M whose edges alternate between edges
outside and inside M. Exchanging the edges of M along such a path gives a matching covering two
more vertices. Berge's lemma states the converse for finite graphs: a matching with no augmenting
path is maximum. The proof is the standard one ([Sch17], Theorem 3.2). If a matching M'
covers more vertices than M, then in M ∆ M' every vertex has degree at most two. The component
of a vertex covered by M' only has a second odd-degree vertex. That vertex is covered by M
only, since otherwise the path between them would be M-augmenting. So M' covers at most as many
vertices as M.
Matchings are Mathlib's SimpleGraph.Subgraph.IsMatching and alternation is Mathlib's
SimpleGraph.IsAlternating.
The results about maximum matchings assume a finite vertex type, as in the source.
Main definitions #
SimpleGraph.Subgraph.IsAugmentingPath M p:pis anM-augmenting path.SimpleGraph.Subgraph.augment M p: the symmetric difference ofMand the edges ofp.SimpleGraph.Subgraph.IsMaximumMatching M:Mis a matching with at least as many edges as every matching.
Main results #
SimpleGraph.Subgraph.IsAugmentingPath.isMatching_augment,SimpleGraph.Subgraph.IsAugmentingPath.ncard_verts_augment: augmenting along an augmenting path gives a matching covering two more vertices.SimpleGraph.Subgraph.IsMatching.exists_isAugmentingPath_of_ncard_lt: if a matching covers more vertices thanM, there is anM-augmenting path.SimpleGraph.Subgraph.IsMatching.isMaximumMatching_iff_forall_not_isAugmentingPath: Berge's lemma. A matching of a finite graph is maximum iff it has no augmenting path.SimpleGraph.exists_isMaximumMatching: every finite graph has a maximum matching.
References #
A vertex of a path other than its two ends has two distinct neighbours on the path.
p is an M-augmenting path: a path between two distinct vertices not covered by M whose
edges alternate between edges outside and inside M ([Ber57]; [Sch17], Section 3.2).
Alternation is Mathlib's SimpleGraph.IsAlternating: of two distinct edges of p at a vertex,
exactly one lies in M. Since both ends are uncovered, the first and last edges lie outside M
and the path has odd length.
- isPath : p.IsPath
- start_notMem : u ∉ M.verts
- end_notMem : v ∉ M.verts
- isAlternating : p.toSubgraph.spanningCoe.IsAlternating M.spanningCoe
Instances For
The matching M ∆ E(p) obtained by augmenting M along the walk p: an edge belongs to it
when it belongs to exactly one of M and p. Its vertices are those of M and of p.
Instances For
An inner vertex of an augmenting path is covered by M.
Augmenting a matching along an augmenting path gives a matching.
The symmetric difference of two matchings #
The symmetric difference of two matchings alternates with respect to the first one. For two
matchings of the same graph, this generalizes Mathlib's
Subgraph.IsPerfectMatching.isAlternating_symmDiff_left from perfect matchings to arbitrary
matchings (Mathlib's lemma allows the second matching to live in a different graph).
A vertex covered by M' but not by M has exactly one neighbour in M ∆ M', its partner
in M'.
A vertex has an odd number of neighbours in M ∆ M' only if exactly one of M and M'
covers it.
Berge's lemma, hard direction ([Ber57], Theorem 1; [Sch17], Theorem 3.2): if
a matching M' covers more vertices than a matching M, then there is an M-augmenting path.
Maximum matchings and Berge's lemma #
M is a maximum matching of G: a matching with at least as many edges as every matching of
G. Edges are counted with Set.encard. The definition needs no finiteness hypothesis, but it
is coarse on infinite graphs, where every matching with infinitely many edges is maximum. The
results below assume [Finite V].
- isMatching : M.IsMatching
Instances For
A matching of a finite graph covers twice as many vertices as it has edges.
In a finite graph, maximality of a matching may be tested by comparing edge counts with
Set.ncard.
In a finite graph a matching is maximum iff it covers at least as many vertices as every matching.
A perfect matching of a finite graph is maximum.
A finite graph has a maximum matching.
Berge's lemma ([Ber57], Theorem 1; [Sch17], Theorem 3.2): a matching of a finite graph is maximum iff there is no augmenting path.