01 / 21

Network Flow
& Optimization

Learn how to model flow through networks, find the maximum flow from source to sink, and apply the powerful Max-Flow Min-Cut Theorem.

Finite Mathematics

What Is a Network?

A network is a directed graph where each edge (arc) has a capacity: the maximum amount of a resource (water, data, traffic) that can travel along it. Every network has a special source node (where flow originates) and a sink node (where flow arrives).

S A B C D T 10 8 6 9 4 7 10

Key Terminology

Capacity
The maximum flow an edge can carry, written \( c(u,v) \).
Flow
The actual amount sent along an edge, written \( f(u,v) \), where \( 0 \le f(u,v) \le c(u,v) \).
Residual Capacity
Remaining room on an edge: \( c_f(u,v) = c(u,v) - f(u,v) \).

Why Flow Matters

Network flow models appear everywhere in real life: internet bandwidth, pipeline systems, transportation logistics, and supply chain management. The core question is always the same: what is the maximum amount we can push from source to sink?

Internet
Routers have bandwidth limits: finding max throughput.
Pipelines
Oil or water pipes have physical capacity constraints.
Traffic
Roads carry limited vehicles per hour: optimizing flow.

The Max-Flow Problem

Given a network with source \( S \) and sink \( T \), find the maximum total flow from \( S \) to \( T \) that respects all capacity constraints and flow conservation.

Max-Flow Min-Cut Theorem

A cut divides the nodes into two groups: one containing \( S \), one containing \( T \). The capacity of a cut is the sum of capacities of edges crossing from the \( S \)-side to the \( T \)-side.

CUT S A B C D T 6 4 9

Finding Augmenting Paths

An augmenting path is any path from \( S \) to \( T \) in the residual graph where every edge has positive residual capacity. The algorithm repeatedly finds such paths and pushes flow along them.

1
Search the residual graph for a path from \( S \) to \( T \).
2
Identify the bottleneck: the smallest residual capacity along the path.
3
Push flow equal to the bottleneck along every edge of the path.
4
Update residual capacities (decrease forward, increase backward).
5
Repeat until no augmenting path exists. The flow is now maximum.

Flow vs. Cut: Key Distinction

Flow Cut
Definition Amount of resource traveling from \( S \) to \( T \) Partition of nodes into \( S \)-side and \( T \)-side
Measure Total flow value \( |f| \) Sum of capacities of crossing edges
Goal Maximize Minimize
Relationship Max flow = Min cut (always equal at optimum)

The Ford-Fulkerson Method

The Ford-Fulkerson method is the foundational algorithm for solving max-flow. It works by repeatedly finding augmenting paths and pushing flow until no more paths exist.

1
Initialize all flows to zero: \( f(u,v) = 0 \) for every edge.
2
Build the residual graph from current flow values.
3
Find an augmenting path \( S \to T \) in the residual graph (using BFS or DFS).
4
Augment flow by the bottleneck capacity of that path.
5
Repeat steps 2–4 until no augmenting path remains. Output \( |f| \).

Step-by-Step Approach

1
Draw the network with labeled nodes and edge capacities.
2
Set all flows to 0. For each edge, track the current flow \(f\) relative to its capacity \(c\).
3
Find a path from \( S \) to \( T \) with available capacity on every edge.
4
Push the bottleneck amount along the path; update all edge labels.
5
Repeat until stuck. Sum the flow out of \( S \) for the max flow.
6
Verify with a min-cut: find the smallest-capacity partition.

Example 1: Simple Network

S A B T 5 3 4 6

Example 2: Cross Edges

S A B C D T 10 8 5 7 6 9 10

Example 2: Solution

1
Path \( S \to A \to C \to T \): Bottleneck is \( \min(10, 5, 9) = 5\). Push \(5\). Total flow: \(5\).
2
Path \( S \to B \to D \to T \): Bottleneck is \( \min(8, 7, 10) = 7\). Push \(7\). Total flow: \(5+7=12\).
3
Path \( S \to A \to D \to T \): Check residual capacities: \(c_f(S,A)=10-5=5\), \(c_f(A,D)=6\), \(c_f(D,T)=10-7=3\). Bottleneck is \(\min(5, 6, 3) = 3\). Push \(3\). Total flow: \(12+3=15\).
4
No More Paths: Edges \(A \to C\), \(B \to D\), and \(D \to T\) are now saturated in the residual graph. No path from \(S\) to \(T\) remains.

Example 3: Backward Edges

S A B T 3 3 2 2 4

Common Mistakes

✕ Ignoring Backward Edges
In the residual graph, backward edges allow rerouting flow. Forgetting them leads to suboptimal solutions.
✕ Exceeding Capacity
Pushing more flow than \( c(u,v) \) on any edge violates the capacity constraint. Always check.
✕ Wrong Cut Calculation
A cut counts only edges going from \( S \)-side to \( T \)-side, not backward. Counting both directions inflates the result.

Summary at a Glance

Concept Definition Key Formula
Capacity Max flow an edge allows \( c(u,v) \)
Flow Actual amount sent \( 0 \le f(u,v) \le c(u,v) \)
Residual Remaining room \( c_f = c - f \)
Max-Flow Greatest total from \( S \) to \( T \) \( |f^*| \)
Min-Cut Smallest partition capacity \( \text{cap}(S^*, T^*) \)
Theorem They are equal \( |f^*| = \text{min-cut} \)

Question 1 of 5

In a flow network, the conservation of flow constraint states that:

Question 2 of 5

A network has edges \(S \to A\) (cap 8), \(S \to B\) (cap 5), \(A \to T\) (cap 6), and \(B \to T\) (cap 7). What is the maximum flow?

Question 3 of 5

The Max-Flow Min-Cut Theorem states that:

Question 4 of 5

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

Question 5 of 5

When computing a minimum cut, which edges do you sum?