01 / 21

Network Flow
Max Flow Introduction

Learn how to model flow through networks, understand capacity constraints, and discover the maximum flow from source to sink.

Discrete Math

What Is a Flow Network?

A flow network is a directed graph where each edge has a capacity: a non-negative upper bound on how much "stuff" can pass through it. Every network has a special source node \( s \) (where flow originates) and a sink node \( t \) (where flow is collected).

Directed Graph
Edges have direction: flow moves one way per edge
Capacity
\( c(u,v) \geq 0 \) for every edge \( (u,v) \)
Source & Sink
Flow starts at \( s \), ends at \( t \)

A Simple Flow Network

s A B C D t 10 8 6 4 9 7 10 5

The Two Fundamental Rules

Any valid flow \( f \) on a network must satisfy two constraints at every edge and every node:

1
Capacity Constraint: For every edge \( (u,v) \), the flow cannot exceed its capacity: \( 0 \leq f(u,v) \leq c(u,v) \).
2
Conservation of Flow: For every node except \( s \) and \( t \), total flow in equals total flow out: \( \sum_{u} f(u,v) = \sum_{w} f(v,w) \).

The Maximum Flow Problem

The value of a flow is the total amount leaving the source (equivalently, arriving at the sink):

The maximum flow problem asks: what is the largest possible value \( |f| \) that satisfies all capacity and conservation constraints?

The Max-Flow Min-Cut Theorem

An s-t cut partitions the nodes into two sets \( S \) and \( T \) with \( s \in S \) and \( t \in T \). The capacity of the cut is the sum of capacities on edges from \( S \) to \( T \):

The theorem states:

Visualizing a Min Cut

min cut S = {s, A, B} T = {C, D, t} s A B C D t 6 9

Flow vs Capacity

These two concepts are related but distinct. Confusing them is the most common source of errors:

Flow \( f(u,v) \) Capacity \( c(u,v) \)
Definition Actual amount sent along an edge Maximum allowed along an edge
Can change? Yes: depends on the flow chosen No: fixed by the network
Constraint \( 0 \leq f(u,v) \leq c(u,v) \) Given as input
Notation \( f(u,v) \) or flow/capacity \( c(u,v) \) or label on edge

Augmenting Paths & Residual Graphs

To find max flow, we use the residual graph: a modified version of the network that shows remaining capacity on each edge.

Forward Edge
Residual capacity = \( c(u,v) - f(u,v) \). Room to push more flow.
Backward Edge
Residual capacity = \( f(u,v) \). Can "undo" existing flow.

The Ford-Fulkerson Method

1
Initialize: Set all flows to \( 0 \). Build the residual graph.
2
Find: Search for an augmenting path from \( s \) to \( t \) in the residual graph (e.g., BFS or DFS).
3
Augment: Push flow equal to the bottleneck (minimum residual capacity along the path).
4
Update: Decrease forward residual capacities, increase backward residual capacities.
5
Repeat: Go to step 2. Stop when no augmenting path exists. The current flow is maximum.

Worked Example: Finding Max Flow

s A B t 4 3 2 3 5

Iteration 1: First Augmenting Path

s A B t 3/4 3/3 0/3 0/2 0/5

Iteration 2: Second Augmenting Path

s A B t 3/3 3/5 3/4 3/3 0/2

Iteration 3: Third Augmenting Path

s A B t 4/4 1/2 4/5 3/3 3/3

Common Mistakes

✕ Ignoring Backward Edges
Forgetting that the residual graph includes backward edges means you may stop too early and miss the true max flow.
✕ Exceeding Capacity
Pushing more flow than an edge's capacity allows. Always check \( f(u,v) \leq c(u,v) \) after each augmentation.
✕ Violating Conservation
Forgetting to check that flow in = flow out at intermediate nodes. Only \( s \) and \( t \) are exempt.

Network Flow Summary

Concept Key Idea Notation
Flow Network Directed graph with capacities, source, sink \( G = (V, E, c, s, t) \)
Flow Value Total flow leaving source \( |f| \)
Capacity Constraint Flow cannot exceed edge capacity \( 0 \leq f(u,v) \leq c(u,v) \)
Conservation Flow in = flow out at internal nodes \( \sum f_{in} = \sum f_{out} \)
Min Cut Partition minimizing crossing capacity \( c(S, T) \)
Max-Flow Min-Cut Max flow = min cut capacity \( \max |f| = \min c(S,T) \)

Question 1 of 5

In a flow network, the conservation of flow constraint applies to which nodes?

Question 2 of 5

If edge \( (u,v) \) has capacity \( c(u,v) = 10 \) and current flow \( f(u,v) = 7 \), what is the residual capacity of the forward edge?

Question 3 of 5

According to the Max-Flow Min-Cut Theorem, the maximum flow in a network equals:

Question 4 of 5

In the Ford-Fulkerson method, the bottleneck of an augmenting path is:

Question 5 of 5

A network has source \( s \) with two outgoing edges of capacity 5 and 8. What is the upper bound on the max flow?