CS6234 L1 Matching
CS6234 L1 Matching
Matching in Graph
Matching in Bipartite Graph [PS82]-Ch10
Matching in General Graphs [PS82]-Ch10
Weighted Matching in Bipartite Graph
[PS82]-Ch 11.111.2
Additional topics:
Reading/Presentation by students
Lecture notes modified from those by Lap Chi LAU, CUHK.
Hon Wai Leong, NUS
Bipartite Matching
Bipartite Matching
A graph is bipartite if its vertex set can be partitioned
into two subsets A and B so that each edge has one
endpoint in A and the other endpoint in B.
Maximum Matching
The bipartite matching problem:
Find a matching with the maximum number of edges.
First Try
Greedy method?
(add an edge with both endpoints unmatched)
Key Questions
How to tell if a graph does not have a (perfect) matching?
N(S)
S
Knig [1931]:
In a bipartite graph, the
the size
size of
of aa maximum
maximum matching
matching
is equal
equal to the size of aa minimum
minimum vertex cover.
Min-max theorem
Algorithmic Idea?
Augmenting Path
10
Optimality Condition
What if there is no more M-augmenting path?
If there is no M-augmenting path, then M is maximum!
Consider
2.
Every vertex in
3.
A component in
4.
Since
an M-augmenting path!
11
Algorithm
Key: M is maximum no M-augmenting path
12
An M-augmenting path
a directed path between two unmatched vertices
13
Complexity
At most n iterations
An augmenting path in
14
Faster Algorithms
16
Isaac
Marking
Jerry
Tutorials
Darek
Solutions
Tom
Newsgroup
17
19
CS6234:
Matching in Graph
Matching in Bipartite Graph
Matching in General Graphs
Weighted Matching in Bipartite Graph
Additional topics:
Reading/Presentation by students
General Matching
22
General Matching
23
Todays Plan
Min-max theorems
[no proofs]
[skip]
24
25
Min-Max Theorem
Knig [1931]:
In a bipartite graph, the size of a maximum matching
is equal to the size of a minimum vertex cover.
26
Augmenting Path?
27
Optimality Condition?
What if there is no more M-augmenting path?
If there is no M-augmenting path, then M is maximum?
Prove the contrapositive:
A bigger matching an M-augmenting path
1.
Consider
2.
Every vertex in
3.
A component in
4.
Since
an M-augmenting path!
28
Algorithm?
Key: M is maximum no M-augmenting path
29
Repeated
Vertex !!!
31
Blossom
Note: When performing search for M-augmenting path,
we may encounter M-blossom!
33
Key idea
(Edmonds 1965) General matching algorithm
34
Key Lemma
(Edmonds) M is a maximum matching in G
M/C is a maximum matching in G/C
Key: M is maximum no M-augmenting path
an M-augmenting path in G
an M/C-augmenting path in G/C
35
an M/C-augmenting path
an M-augmenting path
36
an M-augmenting path
an M/C-augmenting path
Note: Many cases to be considered (see [PS82]-Ch10.)
37
an M-augmenting path
an M/C-augmenting path
38
Algorithm
Key: M is maximum no M-augmenting path
39
Complexity
At most n augmentations.
Each augmentation does at most n contractions.
An alternating walk can be found in O(m) time.
Total running time is O(mn2)
41
Historical Remarks
In his famous paper paths, trees, and flowers, Jack Edmonds:
Introduced the notion of a good algorithm.
Edmonds solved weighted general matching, primal dual.
Linear programming description, a breakthrough in polyhedral combinatorics.
An O(n3) algorithm by Pape and Conradt, 1980
Ref: [SDK83] Syslo, Deo, Kowalik, Prentice-Hall, 1983
Discrete Optimization Algorithms, Ch 3.7
42
Comments by LeongHW:
Skip next few slides on mainly
combinatorial results
(Anyone wants to do this for
reading assignment?)
43
M-alternating forest
Larger forest
M-augmenting path
a blossom
M-alternating forest
45
Edmonds-Gallai Decomposition
46
Chinese Postman
Given an undirected graph, a vertex v, a length l(e) on each edge e,
find a shortest tour to visit every edge once and come back to v.
47
Tutte Matrix
48
CS6234:
Matching in Graph
Matching in Bipartite Graph
Matching in General Graphs
Weighted Matching in Bipartite Graph
Additional topics:
Reading/Presentation by students
50
Todays Plan
Three algorithms
negative cycle algorithm
augmenting path algorithm
primal dual algorithm
Applications
52
First Algorithm
Find maximum weight perfect matching
53
First Algorithm
First Algorithm
Key: M is maximum no negative cycle
55
Complexity
At most nW iterations
A negative cycle in O(n3) time by Floyd Warshall
Total running time O(n4W)
Can choose minimum mean cycle to avoid W
56
Comments by LeongHW:
Skip next few slides on Augmenting Path Algorithm
(Anyone wants to do this for reading assignment?)
57
59
Complexity
At most n iterations
A shortest path in O(nm) time by Bellman Ford
Total running time O(n2m)
Can be speeded up by using Dijkstra: O(m + n log n)
Total running time O(nm + n2log n)
Kuhn (based on proof by Egervary) Hungarian method
60
62
63
Complexity
Augment at most n times, each O(m)
Decrease weighted cover at most m times,
each O(m)
Total running time: O(m2) = O(n4)
Egervary, Hungarian method
History: The algorithm was developed by Kuhn who based it
on work of Egervary [1931], (latent work of D. Konig and J.
Egervary) and was given the name Hungarian method.
See [Schr02]-Ch17 for more details.
64
Quick Summary
65
Faster Algorithms
66
Isaac
Marking
Jerry
Tutorials
Darek
Solutions
Tom
Newsgroup
67
Reading/Presentation Topics:
68