Lecture 20
Max Flow IV
CSE 421 Autumn 2025
1
Previously…
2
The maximum flow problem
Input: a flow network
Output: a s-t flow of maximum value
3
The minimum cut problem
Input: a flow network
Output: a s-t cut of minimum capacity
4
Ford-Fulkerson: summary
5
The Max Flow-Min Cut theorem
6
Theorem: The value of the maximum flow from to is equal to the value of the minimum capacity - cut (i.e. minimum capacity cut separating and ).
Step 1. (“weak duality”) The capacity of any - cut is an upper bound on the maximum flow (in particular, the minimum - cut is an upper bound on the maximum flow).
Step 2. Our proof of correctness of Ford-Fulkerson says something powerful: �not only Ford-Fulkerson finds the Max-Flow, but the output of Ford-Fulkerson achieves the capacity of some cut! (in fact, of the minimum capacity cut, by weak duality).
Another instance of proving a theorem by considering an algorithm!
Proved in two steps:
Today
7
Integer capacities imply integer max flow
Theorem: Consider a graph network where . Then, there exists a max flow which assigns an integer flow to every edge.
Proof:
8
This should be very believable by now. But let’s be clear:
Applications
9
Max Flow and Min Cut are useful if you work for a water company..
But they are also useful if you don’t.
The most common application is assignment/matching problems.
Big idea: let one unit of flow mean “assigning” one job to a person.
Application: Bipartite matching
Input: A bipartite graph
Output: A maximal collection of edges that don’t share any vertices.
10
Application: Bipartite matching
Input: A bipartite graph
Output: A maximal collection of edges that don’t share any vertices.
11
Imagine: jobs on the left, and applicants on the right.�Edges represent pairs that are OK with each other.
Think about: how does this differ from stable matching?
The goal is to match as many pairs as possible.
Application: Bipartite matching
Input: A bipartite graph
Output: A maximal collection of edges that don’t share any vertices.
To cast this as a Max-Flow problem, we need to create a directed graph and identify a source and sink .
12
Application: Bipartite matching
13
Application: Bipartite matching
14
Application: Bipartite matching
15
Application: Bipartite matching
16
Claim: these middle edges of flow 1 form a maximum bipartite matching
Application: Bipartite matching
Claim: The middle edges of flow 1 in the max flow form a maximal bipartite matching.
Proof:
There is a bijection between matchings and integer flows:�matching of size integer flow of value
Why?
17
Application: Bipartite matching
Claim: The middle edges of flow 1 in the max flow form a maximal bipartite matching.
Proof:
There is a bijection between matchings and integer flows:�matching of size integer flow of value
Why? Fix an integer flow. By construction, all edges have capacity 1, and each has only one incoming edge. So each can have at most one outgoing edge of flow 1. �Likewise, since each has only one outgoing edge, each can have at most one incoming edge of flow 1.
18
the vertices in and involved in an edge of flow 1 are paired 1-to-1, i.e.�they form a valid matching. If the matching is of size , the flow is of size as it includes the edges from the source and to the sink.
Application: Bipartite matching
Claim: The middle edges of flow 1 in the max flow form a maximal bipartite matching.
Proof:
There is a bijection between matchings and integer flows:�matching of size integer flow of value
For the inverse map, given any matching of size :
19
This bijection implies that the Max Flow corresponds to the maximal bipartite matching.
Application: Bipartite matching
Runtime:
20
Ford-Fulkerson can be slow
Input: The input is a flow network (with integer capacities)
21
Ford-Fulkerson can be slow
22
Finding a pretty large augmenting path
“Capacity-scaling” Ford-Fulkerson:
Let . Set .
We maintain a scaling parameter . Initialize .
While :
23
The idea: In the early phase, we only consider “highways” with high capacity. As lowers, we start considering the smaller “roads”, and we never go back to the larger scales.
Finding a pretty large augmenting path
“Capacity-scaling” Ford-Fulkerson:
Let . Set .
We maintain a scaling parameter . Initialize .
While :
24
Runtime:
Finding a pretty large augmenting path
“Capacity-scaling” Ford-Fulkerson:
Let . Set .
We maintain a scaling parameter . Initialize .
While :
25
Runtime: There are possible values for the scaling parameter .
Polynomial in the input length
Other Max Flow algorithms
So far, for integer capacities:
Original Ford-Fulkerson: runtime
“Capacity-scaling” Ford-Fulkerson: runtime
26
Are there algorithms where runtime is independent of ?
Edmonds-Karp algorithm
27
Edmonds-Karp’s idea: pick the shortest augmenting path (in terms of # of edges)
Ford-Fulkerson gives a template: pick a path in the residual graph.
Recall..
Follows the Ford-Fulkerson template, but with a particular instantiation for how to pick augmenting paths.
Edmonds-Karp algorithm
28
How to find the shortest path?
Recall: BFS finds the shortest path! (vertices are discovered in order of distance from the source)
Edmonds-Karp algorithm
29
Claim: Only iterations are needed to find the max flow!
Edmonds-Karp algorithm
30
Claim: Only iterations are needed to find the max flow!
Proof ideas:
Max Flow algorithms
For integer capacities:
Original Ford-Fulkerson: runtime
“Capacity-scaling” Ford-Fulkerson: runtime
Chen, Li, Liu, Peng, Probst Gutenberg, Sachdeva [2022!]: runtime
31
For non-integer capacities:
Edmondson-Karp: runtime