Folioby Interconnected
Log InSign Up

Network Flows

Flow networks, the max-flow min-cut theorem, the Ford--Fulkerson method, the Edmonds--Karp algorithm, Dinic's algorithm, and the reduction of bipartite matching to maximum flow.

FO
Folio Official
March 1, 2026

1. Definition of a Flow Network

A flow network with edge capacities. The source s sends flow through the network to the sink t:

10
8
6
4
9
5
7
10
s
a
b
c
d
t

Definition 1 (Flow network).
A flow network is a tuple (G,c,s,t) consisting of a directed graph G=(V,A), a capacity function c:A→R≥0​, a sources∈V, and a sinkt∈V with s=t.
Definition 2 (Flow).
A flow in a network (G,c,s,t) is a function f:A→R≥0​ satisfying:
  1. Capacity constraint:0≤f(u,v)≤c(u,v) for every (u,v)∈A.

  2. Flow conservation: For every vertex v=s,t, (u,v)∈A∑​f(u,v)=(v,w)∈A∑​f(v,w).

The value of f is ∣f∣=(s,v)∈A∑​f(s,v)−(v,s)∈A∑​f(v,s).

2. Residual Graphs and Augmenting Paths

Definition 3 (Residual graph).
Given a flow f, the residual graphGf​=(V,Af​) is defined as follows. For each arc (u,v)∈A:
  • If f(u,v)<c(u,v), include a forward arc(u,v)∈Af​ with residual capacity cf​(u,v)=c(u,v)−f(u,v).

  • If f(u,v)>0, include a backward arc(v,u)∈Af​ with residual capacity cf​(v,u)=f(u,v).

Definition 4 (Augmenting path).
An augmenting path is a directed path from s to t in the residual graph Gf​. Its bottleneck capacity is bottleneck(P)=min(u,v)∈P​cf​(u,v).

3. Cuts and the Max-Flow Min-Cut Theorem

Definition 5 (Cut).
An s-tcut is a partition (S,T) of V with s∈S and t∈T. Its capacity is
c(S,T)=(u,v)∈Au∈S,v∈T​∑​c(u,v).
Theorem 6 (Weak duality).
For any flow f and any s-t cut (S,T), ∣f∣≤c(S,T).
Proof.
Summing the flow conservation equations over all vertices in S yields
∣f∣=(u,v)∈Au∈S,v∈T​∑​f(u,v)−(v,u)∈Av∈T,u∈S​∑​f(v,u)≤(u,v)∈Au∈S,v∈T​∑​c(u,v)=c(S,T).
□
Theorem 7 (Max-flow min-cut theorem).
The following three statements are equivalent:
  1. f is a maximum flow.

  2. There is no s-t augmenting path in Gf​.

  3. There exists an s-t cut (S,T) with ∣f∣=c(S,T).

Proof.
(1)⇒(2): If an augmenting path existed, the flow value could be increased, contradicting maximality.

(2)⇒(3): Let S be the set of vertices reachable from s in Gf​, and set T=V∖S. Since there is no augmenting path, t∈/S, so (S,T) is an s-t cut. For every arc (u,v)∈A with u∈S and v∈T, we have cf​(u,v)=0, i.e., f(u,v)=c(u,v). For every arc (v,u) with v∈T and u∈S, cf​(u,v)=0, i.e., f(v,u)=0. Therefore
∣f∣=u∈S,v∈T​∑​f(u,v)−v∈T,u∈S​∑​f(v,u)=c(S,T).

(3)⇒(1): By weak duality, every flow f′ satisfies ∣f′∣≤c(S,T)=∣f∣, so f is maximum. □

4. The Ford–Fulkerson Method

The Ford–Fulkerson method starts with the zero flow and repeatedly finds an augmenting path in Gf​, pushing flow along it.

Algorithm 1: Ford–Fulkerson Method
Input:
Flow network (G,c,s,t)
Output:
Maximum flow f
for all (u,v)∈A
f(u,v)←0 
end for
while there exists an augmenting path P in Gf​
δ←min{cf​(u,v):(u,v)∈P}
// Bottleneck capacity
for all (u,v)∈P
// Update flow along P
if (u,v)∈A
f(u,v)←f(u,v)+δ
// Forward arc
else
f(v,u)←f(v,u)−δ
// Backward arc
end if
end for
end while
return f
Remark 8.
When capacities are rational, the Ford–Fulkerson method terminates in finitely many steps and produces a maximum flow. With irrational capacities, however, non-convergent examples are known. Moreover, a poor choice of augmenting paths can lead to extremely slow convergence even with integer capacities. The Edmonds–Karp algorithm addresses this by always choosing a shortest augmenting path (via BFS).

5. The Edmonds–Karp Algorithm

Theorem 9 (Edmonds–Karp).
When augmenting paths are chosen by BFS (i.e., shortest in terms of number of arcs), the total number of augmentations is O(∣V∣⋅∣A∣), and the overall running time is O(∣V∣⋅∣A∣2).
Proof.
The key lemma is that for every vertex v, the BFS distance df​(v) from s in Gf​ is monotonically nondecreasing across augmentations. Under this lemma, each arc that becomes a bottleneck must wait for df​ to increase by at least 2 before it can be a bottleneck again. Since df​(v)≤∣V∣, each arc is a bottleneck at most O(∣V∣) times, giving a total of O(∣V∣⋅∣A∣) augmentations. □

6. Dinic's Algorithm

Dinic's algorithm constructs a level graph from Gf​ using BFS, then finds a blocking flow on the level graph. This process is repeated.

Definition 10 (Level graph).
Compute BFS distances d from s in Gf​. The level graphLf​ retains only those arcs (u,v)∈Af​ with d(u)+1=d(v).
Theorem 11 (Running time of Dinic's algorithm).
Dinic's algorithm runs in O(∣V∣2⋅∣A∣) time.
Proof.
Each phase computes a blocking flow on the level graph in O(∣V∣⋅∣A∣) time. After each phase, the BFS distance from s to t strictly increases, so there are at most ∣V∣−1 phases. □
Remark 12.
On unit-capacity networks (all capacities equal to 1), Dinic's algorithm runs in O(∣A∣∣V∣​) time. This is particularly important for bipartite matching (see below).

7. Reduction to Bipartite Matching

Theorem 13 (Bipartite matching via flows).
The maximum matching problem on a bipartite graph G=(X⊔Y,E) reduces to a maximum flow problem: add a source s with arcs of capacity 1 to every vertex in X, and add arcs of capacity 1 from every vertex in Y to a sink t. For each edge (x,y)∈E, add an arc x→y of capacity 1.
Proof.
By the integrality theorem, the maximum flow in a network with integer capacities can be realized as an integer flow. Each arc has capacity 1, so the flow on each arc is 0 or 1. The capacity constraints on arcs incident to s and t ensure that each vertex is used by at most one flow-carrying arc. The arcs carrying flow 1 thus form a matching, and the flow value equals the matching size. □

s
x1​
x2​
x3​
y1​
y2​
y3​
t

Remark 14.
Applying Dinic's algorithm to this network yields the Hopcroft–Karp algorithm, which runs in O(∣E∣∣V∣​) time. This reduction also provides an alternative proof of Kö
Graph TheoryDiscrete MathematicsTextbookNetwork FlowMax-Flow Min-CutFord-Fulkerson
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Graph Theory TextbookPart 9 of 13
Previous
Matchings and Coverings
Next
Planar Graphs

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

Paths and Connectivity

We formalize the notions of walks, paths, and cycles, then develop the theory of connected components, vertex and edge connectivity, cut vertices and bridges, the characterization of bipartite graphs, and Menger's theorem.

Graph TheoryDiscrete MathematicsTextbook
3
Folio Official·March 1, 2026

Eulerian and Hamiltonian Graphs: Two Classical Traversal Problems

From the Bridges of Königsberg to Euler's theorem on Eulerian circuits, directed Eulerian graphs, Hamiltonian cycles, the theorems of Ore and Dirac, and the NP-completeness of the Hamiltonian cycle problem.

Graph TheoryDiscrete MathematicsTextbook
1
Folio Official·March 1, 2026

What the max-flow min-cut theorem is really saying — Duality in action

The maximum flow through a network equals the minimum capacity of a cut separating source from sink. This elegant duality is one of the most beautiful results in combinatorics. We develop intuition through water pipes, augmenting paths, and LP duality.

Graph TheoryMathematicsBetween the Lines
Folio Official·March 1, 2026

Recurrence Relations and Counting: Solving Linear Recurrences

We present the method of characteristic equations for solving linear recurrences with constant coefficients, treat the case of repeated roots, discuss nonhomogeneous recurrences, establish the equivalence with generating functions, and introduce matrix exponentiation and the Kitamasa method.

CombinatoricsDiscrete MathematicsTextbook