User:Lawragatajar/sandbox

In graph theory, Berge's lemma states that a matching M in a graph G is maximum (contains the largest possible number of edges) if and only if there is no augmenting path (a path that starts and ends on free (unmatched) vertices, and alternates between edges in and not in the matching) with M.

It was proven by French mathematician Claude Berge in 1957 (though already observed by Petersen in 1891 and Kőnig in 1931).

Proof
To prove Berge's lemma, we first need another lemma. Take a graph G and let M and M&prime; be two matchings in G. Let G&prime; be the resultant graph from taking the symmetric difference of M and M&prime;; i.e. (M - M&prime;) ∪ (M&prime; - M). G&prime; will consist of connected components that are one of the following:
 * 1) An isolated vertex.
 * 2) An even cycle whose edges alternate between M and M&prime;.
 * 3) A path whose edges alternate between M and M&prime;, with distinct endpoints.

The lemma can be proved by observing that each vertex in G&prime; can be incident to at most 2 edges: one from M and one from M&prime;. Graphs where every vertex has degree less than or equal to 2 must consist of either isolated vertices, cycles, and paths. Furthermore, each path and cycle in G&prime; must alternate between M and M&prime;. In order for a cycle to do this, it must have an equal number of edges from M and M&prime;, and therefore be of even length.

Let us now prove the contrapositive of Berge's lemma: G has a matching larger than M if and only if G has an augmenting path. Clearly, an augmenting path P of G can be used to produce a matching M&prime; that is larger than M — just take M&prime; to be the symmetric difference of P and M (M&prime; contains exactly those edges of G that appear in exactly one of P and M). Hence, the reverse direction follows.

For the forward direction, let M&prime; be a matching in G larger than M. Consider D, the symmetric difference of M and M&prime;. Observe that D consists of paths and even cycles (as observed by the earlier lemma). Since M&prime; is larger than M, D contains a component that has more edges from M&prime; than M. Such a component is a path in G that starts and ends with an edge from M&prime;, so it is an augmenting path.

Corollary 1
Let M be a maximum matching and consider an alternating chain such that the edges in the path alternates between being in and not in M. If the alternating chain is a cycle or a path of even length starting on an unmatched vertex, then a new maximum matching, M&prime; can be found by interchanging the edges found in M and not in M. For example, if the alternating chain is (m1, n1, m2, n2, ...), where mi &isin; M and ni &notin; M, interchanging them would make all ni part of the new matching and make all mi not part of the matching.

Corollary 2
An edge is considered "free" if it belongs to a maximum matching but does not belong to all maximum matchings. An edge e is free if and only if, in an arbitrary maximum matching M, edge e belongs to an even alternating path starting at an unmatched vertex or to an alternating cycle. By the first corollary, if edge e is part of such an alternating chain, then a new maximum matching, M&prime;, must exist and e would exist either in M or M&prime;, and therefore be free. Conversely, if edge e is free, then e is in some maximum matching M but not in M&prime;. Since e is not part of both M and M&prime;, it must still exist after taking the symmetric difference of M and M&prime;. The symmetric difference of M and M&prime; results in a graph consisting of isolated vertices, even alternating cycles, and alternating paths. Because M and M&prime; are the same size (because both are maximum matchings), the alternating path must be of even length. Therefore, e is either in an alternating cycle or an even length alternating path.