Maximum cardinality matching explained

Maximum cardinality matching is a fundamental problem in graph theory.We are given a graph, and the goal is to find a matching containing as many edges as possible; that is, a maximum cardinality subset of the edges such that each vertex is adjacent to at most one edge of the subset. As each edge will cover exactly two vertices, this problem is equivalent to the task of finding a matching that covers as many vertices as possible.

An important special case of the maximum cardinality matching problem is when is a bipartite graph, whose vertices are partitioned between left vertices in and right vertices in, and edges in always connect a left vertex to a right vertex. In this case, the problem can be efficiently solved with simpler algorithms than in the general case.

Algorithms for bipartite graphs

Flow-based algorithm

The simplest way to compute a maximum cardinality matching is to follow the Ford–Fulkerson algorithm. This algorithm solves the more general problem of computing the maximum flow. A bipartite graph can be converted to a flow network as follows.

Since each edge in the network has integral capacity, there exists a maximum flow where all flows are integers; these integers must be either 0 or 1 since the all capacities are 1. Each integral flow defines a matching in which an edge is in the matching if and only if its flow is 1. It is a matching because:

The Ford–Fulkerson algorithm proceeds by repeatedly finding an augmenting path from some to some and updating the matching by taking the symmetric difference of that path with (assuming such a path exists). As each path can be found in time, the running time is, and the maximum matching consists of the edges of that carry flow from to .

Advanced algorithms

An improvement to this algorithm is given by the more elaborate Hopcroft–Karp algorithm, which searches for multiple augmenting paths simultaneously. This algorithm runs in

O(\sqrt{V}E)

time.

The algorithm of Chandran and Hochbaum for bipartite graphs runs in time that depends on the size of the maximum matching, which for is

O\left(min\{|X|k,E\}+\sqrt{k}min\{k2,E\}\right).

Using boolean operations on words of size

λ

the complexity is further improved to

O\left(min\left\{|X|k,

|X||Y|
λ

,E\right\}+k2+

k2.5
λ

\right).

More efficient algorithms exist for special kinds of bipartite graphs:

\tilde{O}(E10/7)

with Madry's algorithm based on electric flows.

Algorithms for arbitrary graphs

The blossom algorithm finds a maximum-cardinality matching in general (not necessarily bipartite) graphs. It runs in time

O(|V|2|E|)

. A better performance of for general graphs, matching the performance of the Hopcroft–Karp algorithm on bipartite graphs, can be achieved with the much more complicated algorithm of Micali and Vazirani.[1] The same bound was achieved by an algorithm by and an algorithm by Gabow and Tarjan.[2]

An alternative approach uses randomization and is based on the fast matrix multiplication algorithm. This gives a randomized algorithm for general graphs with complexity

O(V2.372)

. This is better in theory for sufficiently dense graphs, but in practice the algorithm is slower.[3]

Other algorithms for the task are reviewed by Duan and Pettie[4] (see Table I). In terms of approximation algorithms, they also point out that the blossom algorithm and the algorithms by Micali and Vazirani can be seen as approximation algorithms running in linear time for any fixed error bound.

Applications and generalizations

Notes and References

  1. .
  2. Harold N. Gabow. Harold N. Gabow. Robert E. Tarjan. 1991-10-01. Faster scaling algorithms for general graph matching problems. Journal of the ACM. 38. 4. 815–853. EN. 10.1145/115234.115366. 18350108.
  3. .
  4. Duan. Ran. Pettie. Seth. 2014-01-01. Linear-Time Approximation for Maximum Weight Matching. Journal of the ACM. 61. 1–23. EN. 10.1145/2529989. 207208641.