CMSC 451: Maximum Bipartite Matching: Slides By: Carl Kingsford
CMSC 451: Maximum Bipartite Matching: Slides By: Carl Kingsford
Network Flows
10 20 s 10 10
u 10 20 15 v 5 5
x 20
15
30
30 10 w 5
The network ow problem is itself interesting. But even more interesting is how you can use it to solve many problems that dont involve ows or even networks.
Bipartite Graphs
People Tasks
tas
kx
bipartite graph
Bipartite Matching
People Tasks 1
A matching gives an
done as possible.
c 3
Maximum Bipartite Matching Given a bipartite graph G = (A B , E ), nd an S A B that is a matching and is as large as possible.
Notes:
Were given A and B so we dont have to nd them. S is a perfect matching if every vertex is matched. Maximum is not the same as maximal: greedy will get to
maximal.
Reduce
Given an instance of
bipartite matching,
Create an instance of
network ow.
Where the solution to the
network ow problem can easily be used to nd the solution to the bipartite matching.
To Recap:
1
Given bipartite graph G = (A B , E ), direct the edges from A to B . Add new vertices s and t . Add an edge from s to every vertex in A. Add an edge from every vertex in B to t . Make all the capacities 1. Solve maximum network ow problem on this new graph G .
2 3 4 5 6
The edges used in the maximum network ow will correspond to the largest possible matching!
Analysis, Notes
Because the capacities are integers, our ow will be integral. Because the capacities are all 1, we will either: use an edge completely (sending 1 unit of ow) or not use an edge at all.
use.
We will show that 1 M is a matching 2 M is the largest possible matching
M is a matching
We can choose at most one edge leaving any node in A. We can choose at most one edge entering any node in B .
People a 1 1 1 1 s 1 1 1 d c b 1 1 1 1 1 e 1 5 4 3 1 1 1 2 1 t 1 1 Tasks 1
If there is a ow f of
B A
e 5
B A
e 5
M is as large as possible
Hence, M is maximum.
Running Time
How long does it take to solve the network ow problem on
G?
The running time of Ford-Fulkerson is O (m C ) where m is
e leaving s ce .
Fold-Fulkerson can nd a