Title: Weighted Bipartite Matching
1Weighted Bipartite Matching
2Weighted Bipartite Matching
Given a weighted bipartite graph, find a matching
with maximum total weight.
B
A
Not necessarily a maximum size matching.
3Todays Plan
- Three algorithms
-
- negative cycle algorithm
- primal dual algorithm
- augmenting path algorithm
- Applications
4First Algorithm
Find maximum weight perfect matching
How to know if a given matching M is optimal?
Idea Imagine there is a larger matching M
and consider the union of M and M
5First Algorithm
- Orient the edges (edges in M go up, others go
down) - edges in M having positive weights, otherwise
negative weights
Then M is maximum if and only if there is no
negative cycles
6First Algorithm
- Key M is maximum ? no negative cycle
How to find efficiently?
7Complexity
- At most nW iterations
- A negative cycle in time by Floyd
Warshall - Total running time
- Can choose minimum mean cycle to avoid W
8Augmenting Path Algorithm
- Orient the edges (edges in M go up, others go
down) - edges in M having positive weights, otherwise
negative weights
Find a shortest path M-augmenting path at each
step
9Augmenting Path Algorithm
Theorem each matching is an optimal k-matching.
Let the current matching be M Let the shortest
M-augmenting path be P Let N be a matching of
size M1
10Complexity
- At most n iterations
- A shortest path in time by Bellman
Ford - Total running time
- Can be speeded up by using Dijkstra O(m nlogn)
- Kuhn, Hungarian method
11Primal Dual Algorithm
What is an upper bound of maximum weighted
matching?
What is a generalization of minimum vertex cover?
weighted vertex cover
Minimum weighted vertex cover gt Maximum weighted
matching
12Primal Dual Algorithm
Minimum weighted vertex cover gt Maximum weighted
matching
- Primal Dual
- Maintain a weighted matching M
- Maintain a weighted vertex cover y
- Either increase M or decrease y until they are
equal.
13Primal Dual Algorithm
Minimum weighted vertex cover gt Maximum weighted
matching
- Consider the subgraph formed by tight edges (the
equality subgraph). - If there is a tight perfect matching, done.
- Otherwise, there is a vertex cover.
- Decrease weighted cover to create more tight
edges, and repeat.
14Complexity
- Augment at most n times, each O(m)
- Decrease weighted cover at most m times, each
O(m) - Total running time
- Egrevary, Hungarian method
15Quick Summary
- First algorithm, negative cycle, useful idea to
consider symmetric difference - Augmenting path algorithm, useful algorithmic
technique - Primal dual algorithm, a very general framework
- Why primal dual?
- How to come up with weighted vertex cover?
- Reduction from weighted case to unweighted case
16Faster Algorithms
17Bonus Question 2
(40) Find a maximum weighted k-matching which
can be extended to a perfect matching.
Relation to red-blue matching?
18Application of Bipartite Matching
Jerry
Darek
Tom
Isaac
Marking
Tutorials
Solutions
Newsgroup
Job Assignment Problem Each person is willing to
do a subset of jobs. Can you find an assignment
so that all jobs are taken care of?
- Ad-auction, Google, online matching
- Fingerprint matching
19Application of Bipartite Matching
With Halls theorem, now you can determine
exactly when a partial chessboard can be filled
with dominos.
20Application of Bipartite Matching
- Latin Square a nxn square, the goal is to fill
the square - with numbers from 1 to n
so that - Each row contains every number from 1 to n.
- Each column contains every number from 1 to n.
21Application of Bipartite Matching
Now suppose you are given a partial Latin Square.
Can you always extend it to a Latin Square?
With Halls theorem, you can prove that the
answer is yes.