Network Flow Problems
Network Flow Problems
Jaehyun Park
CS 97SI
Stanford University
Outline
Capacities
Capacities
Flow Decomposition
s a b t: 11
s c a b t: 1
s c d b t: 7
s c d t: 4
Outline
Ford-Fulkerson Algorithm
Ford-Fulkerson Algorithm
Main idea: find valid flow paths until there is none left, and
add them up
How do we know if this gives a maximum flow?
Ford-Fulkerson Algorithm
10
Back Edges
Ford-Fulkerson Algorithm
11
Ford-Fulkerson Pseudocode
Set ftotal = 0
Repeat until there is no path from s to t:
Decrease c(u v) by f
Increase c(v u) by f
Ford-Fulkerson Algorithm
12
Analysis
Ford-Fulkerson Algorithm
13
Computing Min-Cut
Ford-Fulkerson Algorithm
14
Computing Min-Cut
Ford-Fulkerson Algorithm
15
Computing Min-Cut
Ford-Fulkerson Algorithm
16
Computing Min-Cut
Ford-Fulkerson Algorithm
17
Outline
Bipartite Matching
18
Bipartite Matching
Settings:
n students and d dorms
Each student wants to live in one of the dorms of his choice
Each dorm can accommodate at most one student (?!)
Bipartite Matching
19
Bipartite Matching
20
Bipartite Matching
21
Related Problems
Bipartite Matching
22
Outline
23
Min-Cost Max-Flow
Problem: find the maximum flow that has the minimum total
cost
A lot harder than the regular max-flow
24
25
26