Skip to content
Part IA Lent Term

Flow Networks and the Maximum-Flow Problem

A flow network models the movement of a commodity (oil, water, data) through a network with capacity constraints. The problem is to maximise throughput from source to sink.

Definitions

A flow network is a directed graph G=(V,E)G = (V, E) with two distinguished vertices:

  • Source sVs \in V: origin of flow, no incoming flow
  • Sink tVt \in V: destination of flow, no outgoing flow

Each edge (u,v)E(u, v) \in E has a non-negative capacity c(u,v)0c(u, v) \ge 0. We assume no self-loops and (for convenience) no antiparallel edges: if (u,v)E(u, v) \in E then (v,u)E(v, u) \notin E. Antiparallel edges can be removed by inserting a dummy vertex. Every vertex lies on some path svts \leadsto v \leadsto t.

Flow

A flow f:V×VRf: V \times V \to \mathbb{R} satisfies:

  1. Capacity constraint: 0f(u,v)c(u,v)0 \le f(u, v) \le c(u, v) for all u,vVu, v \in V
  2. Flow conservation: for every vertex uV{s,t}u \in V \setminus \{s, t\}:

vVf(v,u)=vVf(u,v)\sum_{v \in V} f(v, u) = \sum_{v \in V} f(u, v)

Total flow in equals total flow out at every internal vertex. We define f(u,v)=0f(u, v) = 0 if (u,v)E(u, v) \notin E.

The value of flow ff is the net flow leaving the source:

f=vVf(s,v)vVf(v,s)|f| = \sum_{v \in V} f(s, v) - \sum_{v \in V} f(v, s)

The second sum is usually zero but is included for generality.

Antisymmetry Convention

For notational convenience, define f(v,u)=f(u,v)f(v, u) = -f(u, v). This lets us write net flow across a cut as a single sum. In practice, flow only exists in forward directions up to capacity; the antisymmetry notion simplifies the algebra of residual networks.

Residual Networks

Given flow ff on GG, the residual network Gf=(V,Ef)G_f = (V, E_f) shows how much additional flow can be pushed on each edge, and where flow can be cancelled:

  • If (u,v)E(u, v) \in E and f(u,v)<c(u,v)f(u, v) < c(u, v), add (u,v)(u, v) to EfE_f with residual capacity cf(u,v)=c(u,v)f(u,v)c_f(u, v) = c(u, v) - f(u, v)
  • If f(u,v)>0f(u, v) > 0 (i.e. (v,u)E(v, u) \in E with positive flow), add (v,u)(v, u) to EfE_f with cf(v,u)=f(u,v)c_f(v, u) = f(u, v)

Residual edges in the reverse direction represent flow cancellation: we can “undo” flow previously sent along the forward edge.

Formally:

cf(u,v)={c(u,v)f(u,v)if (u,v)Ef(v,u)if (v,u)E0otherwisec_f(u, v) = \begin{cases} c(u, v) - f(u, v) & \text{if } (u, v) \in E \\ f(v, u) & \text{if } (v, u) \in E \\ 0 & \text{otherwise} \end{cases}

Augmentation

If ff' is a flow in GfG_f, then the augmented flow fff \uparrow f' is:

(ff)(u,v)=f(u,v)+f(u,v)f(v,u)(f \uparrow f')(u, v) = f(u, v) + f'(u, v) - f'(v, u)

This yields a valid flow in GG with value ff=f+f|f \uparrow f'| = |f| + |f'|.

Problem Statement

Maximum-Flow Problem: given a flow network G=(V,E)G = (V, E) with capacities cc, source ss, and sink tt, find a flow ff of maximum value f|f|.

Applications

  • Transport and logistics networks
  • Bipartite matching (see Maximum Bipartite Matching via Flow)
  • Circulation with demands
  • Image segmentation (min-cut formulation)
  • Edge-disjoint and vertex-disjoint paths
  • Project selection / maximum closure
  • Baseball elimination

Antiparallel Edge Elimination

If (u,v)(u, v) and (v,u)(v, u) both exist with capacities aa and bb, insert a new vertex xx and replace (v,u)(v, u) with (v,x)(v, x) and (x,u)(x, u), both of capacity bb. The resulting network has no antiparallel edges and preserves all feasible flows.

Example

Consider a simple 4-vertex network:

  • sas \to a (capacity 10), sbs \to b (capacity 5)
  • aba \to b (capacity 3), ata \to t (capacity 8)
  • btb \to t (capacity 7)

Simple flow network

A feasible flow sends 8 via sats \to a \to t and 7 via sbts \to b \to t, but the aba \to b edge capacity of 3 constrains redistribution. The maximum flow value is 15 (send 10 on sas \to a, split 8 to tt and 2 via bb, plus 5 from sbs \to b, total 8+2+5=158 + 2 + 5 = 15).

Summary

ConceptDefinition
Flow networkG=(V,E)G = (V, E) with source ss, sink tt, capacities c(u,v)0c(u, v) \ge 0
Capacity constraint0f(u,v)c(u,v)0 \le f(u, v) \le c(u, v)
Flow conservationvf(v,u)=vf(u,v)\sum_v f(v, u) = \sum_v f(u, v) for us,tu \neq s, t
Flow value f\lvert f \rvertNet flow out of ss: vf(s,v)vf(v,s)\sum_v f(s, v) - \sum_v f(v, s)
Residual capacitycf(u,v)=c(u,v)f(u,v)+f(v,u)c_f(u, v) = c(u, v) - f(u, v) + f(v, u)
Augmentationfff \uparrow f' adds residual flow ff' to ff

Past Tripos: y2024p1q9, y2023p2q7.