Maximum-cardinality matching

From testwiki
Jump to navigation Jump to search

Template:Short description

The graph on the right has maximum cardinality matching one less than the graph on the left, despite the fact that they both have the same number of vertices.

In graph theory, a maximum-cardinality matching is a special kind of subgraph useful in many computational contexts. Given a graph Template:Mvar, a matching is a subgraph where no two edges share a vertex. The cardinality of the matching is the number of edges in the subgraph, and the maximum cardinality is the largest number of edges a matching can contain. A matching for a given graph is a maximum-cardinality matching if its cardinality is this maximum cardinality. If we think of each edge as "covering" the vertices it connects exactly once, then a maximal matching is also the largest non-overlapping cover of the graph. If all the vertices are covered, we call it a perfect matching. For finite graphs, a maximum-cardinality matching always exists, but is not usually unique. The cardinality of the matching is never more than half the number of vertices and also never more than the number of edges.

An important special case of the maximum-cardinality matching problem is when Template:Mvar is a bipartite graph representing a binary relation, whose vertices Template:Mvar are partitioned between left vertices in Template:Mvar and right vertices in Template:Mvar, and edges in Template:Mvar 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.

The calculation of a maximum matching for a given graph is a fundamental task in computational graph theory.[1] There are nonconstructive characterization theorems for the size of a maximum matching. This article is about computation of maximum matchings.

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 Template:Math 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 incoming flow into each vertex in Template:Mvar is at most 1, so the outgoing flow is at most 1 too, so at most one edge adjacent to each vertex in Template:Mvar is present.
  • The outgoing flow from each vertex in Template:Mvar is at most 1, so the incoming flow is at most 1 too, so at most one edge adjacent to each vertex in Template:Mvar is present.

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

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(VE) time.

The algorithm of Chandran and Hochbaum[2] for bipartite graphs runs in time that depends on the size of the maximum matching Template:Mvar, which for Template:Math is

O(min⁡{|X|k,E}+kmin⁡{k2,E}).

Using Boolean operations on words of size λ the complexity is further improved to[2]

O(min⁡{|X|k,|X||Y|λ,E}+k2+k2.5λ).

More efficient algorithms exist for special kinds of bipartite graphs:

  • For sparse bipartite graphs, the maximum matching problem can be solved in O~(E10/7) with Madry's algorithm based on electric flows.[3]
  • For planar bipartite graphs, the problem can be solved in time Template:Math where Template:Mvar is the number of vertices, by reducing the problem to maximum flow with multiple sources and sinks.[4]

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 Template:Math 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.[5] The same bound was achieved by an algorithm by Template:Ill[6] and an algorithm by Gabow and Tarjan.[7]

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).[8] This is better in theory for sufficiently dense graphs, but in practice the algorithm is slower.[2]

Other algorithms for the task are reviewed by Duan and Pettie[9] (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

References

Template:Reflist