0% found this document useful (0 votes)
66 views3 pages

Bipartite Matching, Max Flow

This lecture discusses maximum bipartite matching and maximum flow problems. For maximum bipartite matching, a linear program can be formulated to find the maximum number of edges in a matching between two disjoint vertex sets of a bipartite graph. Maximum flow problems aim to find the maximum amount of flow that can be sent from a source to a sink node in a flow network, subject to capacity constraints on edges. Maximum flow problems can be reduced to maximum bipartite matching problems and solved using a linear programming formulation with flow conservation constraints. The dual linear program corresponds to finding a minimum cut that partitions the graph into two sets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views3 pages

Bipartite Matching, Max Flow

This lecture discusses maximum bipartite matching and maximum flow problems. For maximum bipartite matching, a linear program can be formulated to find the maximum number of edges in a matching between two disjoint vertex sets of a bipartite graph. Maximum flow problems aim to find the maximum amount of flow that can be sent from a source to a sink node in a flow network, subject to capacity constraints on edges. Maximum flow problems can be reduced to maximum bipartite matching problems and solved using a linear programming formulation with flow conservation constraints. The dual linear program corresponds to finding a minimum cut that partitions the graph into two sets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

COMPSCI 330: Design and Analysis of Algorithms Mar 30, 2020

Lecture 17: Bipartite Matching, Max Flow


Lecturer: Rong Ge Scribe: Haoming Li

Overview

In this lecture, we will discuss two problems, maximum bipartite matching and maximum flow, and the
linear programs that solve them. We will also interpret the dual of the LP for maximum flow.

17.1 Maximum Bipartite Matching

Here’s a motivating problem: There are a number of courses and classrooms. Because of different require-
ments (capacity, facility, location etc.) each course can only use a subset of classrooms. For each course, we
are given the list of classrooms that it can use. We want to match as many courses to classrooms as we can.
Each course only needs one classroom, and each classroom can only hold one course.
This problem can be modeled as a maximum bipartite matching problem. In this problem, we are given a
bipartite graph G = (U, V, E), a graph whose vertices can be divided into two disjoint sets U and V such
that every edge connects a vertex in U to one in V . We want to choose as large a subset of edges M ∈ E as
possible that forms a matching, a set of edges that do not share any vertices.

17.1.1 LP for Maximum Bipartite Matching

We can use a linear program to solve for a maximum matching. For each edge (i, j), we will have one variable
xij that takes on value 1 if (i, j) ∈ M or 0 if (i, j) 6∈ M . That is, a pair of course and classroom (i, j) that
can be matched ends up either matched or not. The objective function follows immediately:
X
max xij
(i,j)∈E

That is, we want to maximize the number of edges that are in the matching. The constraint we have to
respect in this problem is that every course i uses at most 1 classroom and every classroom j holds at most
1 course. That is:

X
xij ≤ 1, ∀i ∈ U
(i,j)∈E
X
xij ≤ 1, ∀j ∈ V
(i,j)∈E

Lastly, we may relax the integral constraint on the variable, so that we can have a linear program (LP) as
opposed to an integer linear program (ILP). That is:
0 ≤ xij ≤ 1, ∀(i, j) ∈ E

As we will see below, the reason we can do this is that, even though there possibly are fractional optimal
solutions that assign fractional values to xij (which cannot be interpreted as a matching), there always exists
an integral optimal solution that can be found by the LP.

17-1
17-2 Lecture 17: Bipartite Matching, Max Flow

17.2 Maximum Flow

The maximum flow problem states the following: Given a directed graph G = (V, E), where each edge (i, j)
has a capacity cij , a starting vertex s and an ending vertex t, we want to find a maximum flow from s to
t, with the constraint that 1) the flow sent on every edge cannot exceeds its capacity, and that 2) for every
vertex other than s and t, incoming flow must equal outgoing flow.

17.2.1 Using Maximum Flow to Solve Maximum Bipartite Matching

We can reduce a maximum bipartite matching problem to a maximum flow problem. Given a bipartite graph
G = (U, V, E), we 1) add a vertex s and edges (s, u) of capacity 1 to every vertex u ∈ U , 2) add a vertex t
and edges (v, t) of capacity 1 from every vertex v ∈ V , and 3) make every edge (u, v) ∈ E directed and with
capacity 1. This creates an instance of maximum flow problem.
The integrality theorem states that, if all capacities are integers, then there exists an optimal solution for
which the amount of flow sent on every edge is an integer. Such integral optimal solution to the maximum flow
problem constructed above corresponds to an optimal solution to the original maximum bipartite matching
problem.

17.2.2 LP for Maximum Flow

We can use a linear program to solve for a maximum flow. For each edge (i, j), we will have one variable xij
represents the amount of flow sent on this edge. The objective follows immediately:
X X
max xs,j or max xi,t
(s,j)∈E (i,t)∈E

The flow sent on every edge cannot exceeds its capacity:

xij ≤ cij , ∀(i, j) ∈ E

At every vertex i, incoming flow must equal outgoing flow:


X X
xij = xki , ∀i ∈ V \{s, t}
(i,j)∈E (k,i)∈E

Lastly, the sign constraint says that the amount of flow sent on edges must be positive:

xij ≥ 0, ∀(i, j) ∈ E

17.2.3 Dual of the LP for Maximum Flow

Let’s take the duel of the above LP and try to interpret it. For every capacity constraint on edge (i, j), we
will have a dual variable λij . For every flow conservation constraint on vertex i 6∈ V \{s, t}, we will have a
dual variable yi . For every variable xij on edges that are not adjacent to s or t, we have constraint:

λij + yi − yj ≥ 0, ∀(i, j) ∈ E, i, j 6= s, t

For variables on edges that are adjacent to s or t (assuming we went with the first of the two equivalent
primal objective), we have constraint:

λsj − yj ≥ 0, ∀(s, j) ∈ E
Lecture 17: Bipartite Matching, Max Flow 17-3

λit + yi ≥ 1, ∀(i, t) ∈ E

The dual objective comes from the RHS of the canonical primal constraints:
X
min cij λij
(i,j)∈E

The sign constraints on the dual variables come from the signs of the canonical primal constraints:

λij ≥ 0, ∀(i, j) ∈ E

yi ∈ R, ∀i ∈ V \{s, t}

We can then simplify this LP to: X


min cij λij
(i,j)∈E

λij + yi − yj ≥ 0, ∀(i, j) ∈ E
ys = 0
yt = 1
With the same sign constraints. This dual LP in fact solves the minimum cut problem.

17.2.4 Minimum Cut

A cut is a partition of the vertices of a graph into two disjoint subsets. Given a directed graph G = (V, E)
with capacity on edges and vertex s and t, a minimum cut partitions the vertices into S and T such that 1)
s ∈ S, 2) t ∈ T , and 3) the total capacity of the edges that are directed from S to T is minimize. Such edges
are said to be in the cut.
Inspecting the dual LP above, we see that an optimal solution will assign λij = max{yj − yi , 0}. Without
loss of generality, we can assume 0 ≤ yi ≤ 1. An integral solution will assign yi = 0 if i ∈ S and yi = 1 if
i ∈ T . Meanwhile, it will assign λij = 1 if (i, j) is in the cut and λij = 0 if not.
The strong duality theorem tells us that the optimal solution to the LP for maximum flow equals to that to
its dual, the LP for minimum cut. This is known as the max-flow min-cut theorem.

You might also like