Proofs: Micali-Vazirani algorithm
These are the human proofs of Micali-Vazirani algorithm, at full length.
The Micali-Vazirani algorithm returns a maximum matching full
This proof shows: correctness, termination.
Let be a finite general graph with vertices, and let be the matching at the start of a phase. Write for the length of a shortest -augmenting path ( if there is none). The proof has a part that is proved here and one lemma about the search that is cited.
Lemma 1 (the search, cited). In a phase:
(a) for every vertex of tenacity at most , MIN and MAX assign the correct minlevel and maxlevel of , and every bridge of tenacity is in the list of level by the end of MIN at level ;
(b) for a bridge processed in line L5, DDFS either returns the highest bottleneck below and , or two distinct free vertices with vertex-disjoint paths to them in the graph of predecessors and buds;
(c) a vertex erased in line L8 lies on no shortest augmenting path that is vertex-disjoint from the paths found so far in the phase, and opening petals in line L7 gives an augmenting path of length that uses no erased vertex.
This is Theorem 34, Lemma 33, Theorem 28 and Section 7.3 of Vazirani, A simplification of the MV matching algorithm and its proof (arXiv:1210.4594, 2013). The rest of this page shows how the result of the algorithm follows from it.
Lemma 2 (one phase). If , the phase augments along a nonempty set of vertex-disjoint augmenting paths of length , and no augmenting path of length is disjoint from all of them. If , the phase augments nothing.
Proof. Each augmentation in line L8 uses a path built in line L7. Before it changes , the implementation checks that is simple, that its ends are free, and that its edges alternate between edges outside and inside the current matching, starting and ending outside. So is an augmenting path of the current matching, and flipping its edges gives a matching with one more edge. Line L8 then erases all vertices of . Lines L5 and L7 never use erased vertices, so the paths of one phase are vertex-disjoint. A vertex on none of them keeps its mate, so each path is also an augmenting path of , with the same edges outside and inside the matching.
If , there is no augmenting path, and by the check above no path is ever flipped. Let . The levels and bridges up to tenacity are correct by Lemma 1(a). At each level , every DDFS ends at a bottleneck or with an empty support, because two free vertices with disjoint paths from the ends of a bridge of tenacity would give an augmenting path of length , by Lemma 1(c). At level , some bridge of tenacity lies on a shortest augmenting path, so the first DDFS on such a bridge whose ends are not erased returns two free vertices by Lemma 1(b), and a path is found. Line L9 then ends the phase after level , so all paths found have length . Finally, suppose an augmenting path of length is disjoint from all paths found. By Lemma 1(c), none of its vertices is erased. It contains a bridge of tenacity , which is processed at level , and Lemma 1(b) and (c) then give another path disjoint from those found, which the algorithm would have flipped. This contradicts the choice of .
Lemma 3 (shortest lengths grow). Let a phase start with and , find the paths , and end with . Then every -augmenting path has more than edges.
Proof. Let be an -augmenting path. If shares no vertex with the , it is -augmenting, so it has at least edges, and by Lemma 2 it does not have exactly . Otherwise meets some at a vertex . Every vertex of is matched in by an edge of , so is not an end of , and contains that edge. Now is a matching with edges, and . The symmetric difference of two matchings is a union of vertex-disjoint paths and cycles, and since has more edges than , it contains at least vertex-disjoint -augmenting paths, each with at least edges. So . The left side equals , so . Nothing here uses bipartiteness.
Termination. Each phase that finds a path increases , and . A phase that finds no path makes line L10 return. So there are at most phases. Within a phase, the loop of line L3 runs at most times, and each DDFS and each petal opening only moves to unvisited vertices or down to lower levels, so each step stops.
Theorem. The algorithm returns a maximum matching of .
Proof. By Lemma 2, each phase keeps a matching. The algorithm stops after a phase that finds no augmenting path. By Lemma 2 this happens only when , that is, when has no augmenting path. By Berge's lemma, is then a maximum matching. By Lemma 3 and the argument of Hopcroft and Karp, the number of phases is also .