Definition

Let be a graph.

Matching (): A subset of edges such that no two edges in are incident to the same vertex. Formally, for any two distinct edges and , we must have

Perfect Matching: A matching is called a perfect matching if every vertex in is covered by . A perfect matching pairs up all vertices in the graph. For a perfect matching to exist, the graph must have an even number of vertices, and

Inclusion-Maximal Matching: A matching is inclusion-maximal if no more edges can be added to while still maintaining the matching property. In other words, there is no other matching with and

Cardinality-Maximal Matching (Maximum Matching):

A matching is cardinality-maximal (or simply maximum) if there is no other matching with

A maximum matching is always inclusion-maximal, but the converse is not necessarily true.

Greedy Algorithm

Greedy algorithm gives us the inclusion-maximal matching in with

M-augmenting path

Given a matching in a graph , an -augmenting path is a simple path in with the following properties:

Alternating Path: The edges of alternately belong to the matching and not to the matching . That is, if we traverse the path, the edges appear in the sequence:

Starts and Ends at Unmatched Vertices: Both endpoints of the path are unmatched vertices with respect to . That is, neither endpoint is incident to any edge in .

Property

  • Every not cardinality-maximal matching has at least one augmenting path.
  • Every augmenting path provides us a new matching that is bigger.

This means we can exchange the “not in M” edges with “in M” edges, such that we construct (XOR) with

Hall’s Theorem

NOTE

A bipartite graph has a matching () if and only if ( is perfect matching if )

trivial, proved by contraposition not trivial: Proof by induction: induction on the size on the graph let hypothesis: the theorem holds for all and base case: : trivial, just choose an edge steps:

  • case 1: OR in other words
    • we can always delete an edge (including the nodes) from and still holds, because we deleted at most one neighbor of any .
    • This reduces the problem to , which is proved by induction
  • case 2:
    • There is a perfect matching from to
    • Let not and
    • There is a perfect matching from

Corollary

Every -regular bipartite graph contains a perfect matching.

Explanation

A k-regular bipartite graph is one where every vertex in both partitions A and B has a degree of exactly k

These graphs are union from perfect matching

Finding the perfect matching in bipartite graph

NOTE

In -regular bipartite graph one can find a perfect matching in time

We split the graph into two regular graph with degrees (for each node) and split the graph until it is -regular Find the Euler tour in this regular graph and delete every second edge. This gives a perfect matching. Then we can find a perfect matching for regular graph, regular graph and so on. In the end we have time

Berge’s Theorem

NOTE

Every matching that is not maximal has a augmenting path (M-augmenting path)

Simple BFS approach

We can find this (shortest) augmenting path by using BFS

Inefficiency

While the BFS approach works, a naive implementation might perform redundant work in each iteration. Consider that in each iteration, we find only one augmenting path and increase the matching size by just one. We might need to repeat this process many times, potentially up to  iterations in the worst case. (see perfect matching in this note) The solution is to use Hopcroft-Karp algorithm

Overview of Matching Algorithms

For bipartite graphs:

Hopcroft-Karp Algorithm (Unweighted):
Achieves a time complexity of

More Advanced Algorithms (Weighted):
Algorithms exist with complexities close to

for weighted bipartite matching, especially with polynomially bounded weights.

For general graphs (non-bipartite):

Micali-Vazirani Algorithm (Unweighted):
A complex algorithm that achieves a time complexity of

similar to Hopcroft-Karp for bipartite graphs.
Gabow-Tarjan algorithm is another algorithm with similar complexity.

Matrix Multiplication Based Algorithms (Unweighted):
Algorithms using fast matrix multiplication have achieved slightly better theoretical complexities like

for unweighted maximum matching.

Gabow’s Algorithms (Weighted):
For weighted matching in general graphs, algorithms like Gabow’s algorithms exist, with complexities around

for finding maximum weight or minimum weight perfect matchings.