Maximum Flow: Network Flow Problems and Algorithms

Graduate Depth 67 in the knowledge graph I know this Set as goal
Unlocks 4 downstream topics
graphs flow algorithms

Core Idea

The maximum flow problem finds the maximum amount of flow from a source to a sink along weighted edges with capacity constraints. Algorithms like Ford-Fulkerson use augmenting paths in O(E·max_flow) time; Edmonds-Karp uses BFS for O(VE²) worst-case time. Applications include bipartite matching, airline scheduling, and network design.

How It's Best Learned

Implement Ford-Fulkerson with DFS, then Edmonds-Karp with BFS. Trace augmenting paths and residual graph updates. Apply to bipartite matching by constructing a flow network.

Common Misconceptions

Explainer

A flow network is a directed graph where each edge has a capacity — a maximum amount of "stuff" that can pass through it per unit time. There is a designated source node (where flow originates) and a sink node (where flow is consumed). Think of it as a system of pipes: each pipe has a maximum throughput, and you want to push as much water as possible from a pump (source) to a reservoir (sink). The maximum flow problem asks: what is the greatest total flow you can route from source to sink without exceeding any edge's capacity?

The foundational insight is the Ford-Fulkerson method, which works by repeatedly finding augmenting paths — routes from source to sink along which additional flow can be pushed. You start with zero flow everywhere, find a path with available capacity, and push as much flow as possible along it. The trick is the residual graph: after pushing flow along an edge, you create a "reverse edge" that allows you to undo that decision later. This reverse edge is essential because greedy path choices can lead to suboptimal solutions. The residual graph lets the algorithm effectively reroute flow, correcting earlier mistakes without backtracking explicitly. When no more augmenting paths exist in the residual graph, you have found the maximum flow.

The basic Ford-Fulkerson approach using DFS to find augmenting paths runs in O(E × max_flow) time, which can be slow if the maximum flow value is large. The Edmonds-Karp algorithm improves this by always choosing the shortest augmenting path (using BFS), which guarantees termination in O(V × E²) time regardless of capacity values. More advanced algorithms like Dinic's achieve O(V² × E) by exploiting the layered structure of the residual graph more aggressively.

The max-flow min-cut theorem ties everything together: the maximum flow from source to sink equals the minimum capacity of any cut separating source from sink. A cut is a partition of vertices into two sets (one containing the source, the other containing the sink), and its capacity is the sum of capacities of edges crossing from the source side to the sink side. This duality is not just theoretically elegant — it means that solving max-flow automatically solves min-cut, which has its own applications in network reliability, image segmentation, and resource allocation.

What makes maximum flow especially powerful is its versatility as a modeling tool. Bipartite matching — assigning workers to jobs, students to projects, or applicants to positions — reduces directly to max-flow by connecting a super-source to one side, a super-sink to the other, and giving every edge capacity one. If the maximum flow equals k, you can match k pairs. Problems in scheduling, circulation, edge-disjoint paths, and even baseball elimination can all be encoded as flow networks. Recognizing when a problem is secretly a max-flow problem is one of the most valuable pattern-matching skills in algorithm design.

Practice Questions 5 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsInteger Order of OperationsVariable ExpressionsCombining Like TermsOne-Step EquationsTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesLiteral EquationsSlope-Intercept FormPoint-Slope FormWriting Linear EquationsParallel and Perpendicular Line SlopesGraphing Linear EquationsPiecewise FunctionsStep FunctionsComposition of FunctionsInverse FunctionsRadical Functions and GraphsRational ExponentsExponential Functions and GraphsLogarithms IntroductionBig-O Notation and Asymptotic AnalysisAlgorithm Analysis and Complexity ClassesDivide-and-Conquer and the Master TheoremDivide and ConquerQuicksortSelection Algorithms: Finding the kth Smallest ElementMaximum Flow: Network Flow Problems and Algorithms

Longest path: 68 steps · 381 total prerequisite topics

Prerequisites (6)

Leads To (2)