IE331 Lecture14 Note
IE331 Lecture14 Note
Lecture #14: Maximum st-flow and bipartite matching April 13, 2023
Lecturer: Dabeen Lee
1 Outline
In this lecture, we cover
• bipartite matching.
2 Maximum st-flow
The minimum cost flow model we learned does not have a designated source or a sink. In this
section, we discuss a network flow model with a sink node and a source node. Let s and t be
the source node and the sink node, respectively. The source node s sends flows, and the sink node
receives the flows sent by the source. The other nodes are transhipment node, meaning that the
othder nodes have 0 net supply. Each arc in the given network has an upper bound on the amount
of flowws that it can take, i.e.
0 ≤ xij ≤ cij , (i, j) ∈ A.
Then the problem is to compute the maximum amount of flows that the source node s can send to
the sink node t while obeying the flow capacities of arcs.
Although this problem seems different from the minimum cost flow problem, we may formulate the
problem as a min cost flow model. The common trick is to add a dummy arc from the sink node t
to the source node s. This dummy arc (t, s) sends back all the flows coming from s to t. Basically,
we impose that X X
xts = xkt − xtj .
k∈N :(k,t)∈A j∈N :(t,j)∈A
| {z }
the net amount of flows into t
Moreover, A′ = A ∪ {(t, s)} is the arc set of the new network obtained after adding the dummy arc
1
(t, s). Then
X X
0 = xts + xtj − xkt
j∈N :(t,j)∈A k∈N :(k,t)∈A
X X
= xtj − xkt .
j∈N :(t,j)∈A′ k∈N :(k,t)∈A′
| {z }
the net amount of flows into t in the new network
Furthermore, the amount of flows that the sink node t receives is equal to the amount of flows that
the source node s sends out. Hence, we have
X X X X
xsj − xks = xkt − xtj = xts
j∈N :(s,j)∈A k∈N :(k,s)∈A k∈N :(k,t)∈A j∈N :(t,j)∈A
| {z }
the net amount of flows out of s
The other nodes in the network are transhipment nodes and are not connected to the dummay arc
(t, s), so we have X X
xij − xki = 0, i ∈ N \ {s, t}.
j∈N :(i,j)∈A′ k∈N :(k,i)∈A′
max xts
X X
s.t. xij − xki = 0, ∀i ∈ N
j∈N :(i,j)∈A∪{(t,s)} k∈N :(k,i)∈A∪{(t,s)}
Observe that the dummy arc xts is a free variable, which is equivalent to −∞ ≤ xts ≤ +∞. As
this formulation is an instance of the minimum cost flow model, it returns an integer flow as long
as the capacities cij for (i, j) ∈ A are integers.
3 Bipartite matching
A bipartite graph is a graph G = (V, E) where
• each edge e ∈ E crosses the partition, i.e. e has one end in V1 and the other end in V2 .
For example, Figure 14.2 shows a bipartite graph on 7 vertices where one set contains 3 and the
other has 4. A matching is a set of edges without common vertices. In Figure 14.2, the set of
2
Figure 14.2: Bipartite graph and a matching
green edges gives rise to a matching. The matching problem is to find a matching that has the
maximum number of edges.
The first approach is to reduce bipartite matching to maximum st-flow. Given a bipartite graph
G = (V, E) with V partitioned into V1 and V2 , we run the following transformation procedure.
• Direct every edge (u, v) where u ∈ V1 and v ∈ V2 so that (u, v) becomes an arc from u to v.
3
Then the following linear program computes a maximum st-flow over the above network.
X
max xsu
u∈V1
X
s.t. xuv − xsu = 0, u ∈ V1
v∈V2 :(u,v)∈E
X
xvt − xuv = 0, v ∈ V2
u∈V1 :(u,v)∈E
In particular, there is an optimal solution x∗ that has integer entries only. As each component of
x∗ is between 0 and 1, we may select
M = {(u, v) ∈ E : x∗uv = 1} .
Note that X
x∗uv = x∗su ≤ 1.
v∈V2 :(u,v)∈E
Therefore, v is connected to at most one edge in M . This implies that M is a matching. In fact,
|M | is the size of the matching, and moreover,
X
|M | = x∗uv .
u∈V1
This implies that we have just solved bipartite matching by maximum st-flow.