Matching
Definition
A matching in a graph is a set of edges with no shared vertices.
Vertices incident to edges in are matched or saturated.
Types of Matchings
Maximum matching: Matching with maximum number of edges.
Perfect matching: Matching that saturates all vertices. (Exists only if is even)
Maximal matching: Matching that can't be extended by adding more edges. (Not necessarily maximum)
Hall's Marriage Theorem
For a bipartite graph :
A matching that saturates exists if and only if:
where = set of neighbors of vertices in .
Corollary
A -regular bipartite graph has a perfect matching.
Matching in Bipartite Graphs
König's Theorem
In a bipartite graph:
Finding Maximum Matching
Hungarian Algorithm:
Hopcroft-Karp Algorithm:
Alternating and Augmenting Paths
Alternating path: Path alternating between matching and non-matching edges.
Augmenting path: Alternating path from unmatched vertex to unmatched vertex.
Berge's Lemma: A matching is maximum iff there's no augmenting path.
Vertex Cover
Definition
A vertex cover is a set of vertices such that every edge has at least one endpoint in the set.
Minimum vertex cover: Vertex cover of minimum size.
Relationship to Independent Set
is a vertex cover iff is an independent set.
where = independence number, = vertex cover number.
Edge Cover
Definition
An edge cover is a set of edges such that every vertex is incident to at least one edge.
Only exists if graph has no isolated vertices.
Relationship to Matching
Gallai's Theorem: For graph with no isolated vertices:
where = maximum matching size, = minimum edge cover size.
König-Egerváry Theorem
For bipartite graphs:
where = maximum matching size, = minimum vertex cover size.
Stable Matching Problem
Input: men, women, each with complete preference rankings.
Goal: Find a stable matching (no pair would rather be together than with current partners).
Gale-Shapley Algorithm
while some man m is free and hasn't proposed to everyone:
m proposes to his most preferred woman w he hasn't proposed to
if w is free:
w accepts
else if w prefers m to current partner m':
w accepts m, m' becomes free
else:
w rejects m
Properties
- Always finds a stable matching
- Men-proposing version is men-optimal, women-pessimal
- Runs in time
Weighted Matching
Assignment Problem
Given bipartite graph with edge weights, find maximum-weight perfect matching.
Solved by:
- Hungarian Algorithm:
- Auction Algorithm
Applications
- Job assignment
- Resource allocation
- Transportation problems
Network Flow Connection
Maximum Bipartite Matching via Flow
- Add source connected to all vertices in
- Add sink connected to all vertices in
- Direct all edges from to
- All capacities = 1
- Maximum flow = maximum matching size
General Graph Matching
Tutte's Theorem
Graph has a perfect matching iff for every :
where = number of odd components in .
Edmond's Blossom Algorithm
Finds maximum matching in general graphs in .
Applications
Job Assignment
Workers as one side, jobs as other. Edge if worker can do job.
Matching Markets
Doctors to hospitals, students to schools.
Resource Allocation
Tasks to machines with capacity constraints.