Skip to content
Part IA Lent Term

Applications of Maximum Flow

The maximum-flow framework extends far beyond literal flow problems. Many combinatorial optimisation problems reduce to flow networks. The key skill for Tripos is recognising when a problem “feels like max flow” and constructing the right network.

Edge-Disjoint Paths

Problem: find the maximum number of edge-disjoint paths from ss to tt in a directed graph.

Reduction: give every edge capacity 1. Run max flow. Each unit of flow corresponds to one path. Since capacities are 1, no edge can carry flow from two different paths simultaneously. The max flow value equals the maximum number of edge-disjoint paths. Running time: O(VE2)O(|V| \cdot |E|^2) with Edmonds-Karp.

Menger’s Theorem then follows: the maximum number of edge-disjoint ss-tt paths equals the minimum number of edges whose removal disconnects ss from tt (the minimum edge cut).

Vertex-Disjoint Paths

Problem: find maximum number of vertex-disjoint ss-tt paths (paths sharing no vertices except ss and tt).

Reduction: split each vertex vs,tv \neq s, t into vinv_{\text{in}} and voutv_{\text{out}} with a capacity-1 edge vinvoutv_{\text{in}} \to v_{\text{out}}. Replace each original edge (u,v)(u, v) with (uout,vin)(u_{\text{out}}, v_{\text{in}}) of capacity \infty (or a sufficiently large value). Run max flow. The capacity-1 internal edge ensures each vertex is used by at most one path.

Circulation with Demands

Problem: each vertex vv has a demand d(v)d(v): positive means supply, negative means demand (net requirement to consume flow). Find a feasible flow satisfying all demands, or determine none exists.

Reduction: add supersource ss^* and supersink tt^*. For each vertex with d(v)>0d(v) > 0 (supply), add edge (s,v)(s^*, v) with capacity d(v)d(v). For each vertex with d(v)<0d(v) < 0 (demand), add edge (v,t)(v, t^*) with capacity d(v)-d(v). Original edges keep their capacities. Run max flow from ss^* to tt^*. Feasible circulation exists iff all edges from ss^* are saturated.

Project Selection / Maximum Closure

Problem: given a set of projects, each with profit pip_i (positive or negative), and dependencies (project aa requires project bb), select a subset maximising total profit.

Reduction: bipartite-style network. Projects with pi>0p_i > 0 connect from ss with capacity pip_i. Projects with pi<0p_i < 0 connect to tt with capacity pi-p_i. For each dependency aba \to b (aa requires bb), add edge (a,b)(a, b) with capacity \infty. The minimum cut produces the optimal selection: projects on the ss-side of the cut are selected. Max profit =pi>0pimin-cut capacity= \sum_{p_i > 0} p_i - \text{min-cut capacity}.

Image Segmentation

Problem: partition pixels into foreground and background, balancing pixel affinities with prior expectations.

Reduction: graph where each pixel is a vertex with edges to neighbours. Source represents foreground, sink represents background. Edge capacities encode how strongly a pixel “prefers” each label, and how much adjacent pixels should agree. The minimum cut gives the optimal segmentation.

Supersources and Supersinks

Multiple sources s1,,sms_1, \ldots, s_m and multiple sinks t1,,tnt_1, \ldots, t_n reduce to a single source/sink pair by adding a supersource ss with infinite-capacity edges to each sis_i, and a supersink tt with infinite-capacity edges from each tjt_j. This is a standard trick for any flow problem with multiple origins or destinations.

Recognising Flow Problems

Common signs a problem reduces to max flow:

  • Items must be assigned to slots, with each item/slot used at most once (capacity 1)
  • Constraints are local (edge capacities) and sequential (paths)
  • The objective involves a “bottleneck” or “separation”
  • The problem is about cutting or separating a graph into two parts

Summary

ApplicationKey Reduction Trick
Edge-disjoint pathsCapacity 1 on all edges
Vertex-disjoint pathsSplit each vertex vvinvoutv \to v_{\text{in}} \to v_{\text{out}} with capacity 1
CirculationSupersource/sink + demands as edge capacities
Project selectionSource for profits, sink for costs, \infty-capacity dependencies
Image segmentationGraph on pixels, min-cut = optimal labelling
Multiple sources/sinksSupersource + supersink with \infty edges

Past Tripos: y2024p2q7, y2022p1q9.