Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed
Design & Analysis of Algorithms · Lecture 19 of 34 · 1:22:32
14. Incremental Improvement: Matching
Study guide
What this lecture covers
This lecture answers why the Ford-Fulkerson algorithm actually produces a maximum flow, how fast it runs, and how network flow can be used as a general-purpose tool to solve problems that don't look like flow problems at first. It is the second of two lectures on network flow in MIT's 6.046, following the lecture that introduced flow networks, cuts, and residual graphs.
By the end, you can state and prove the max-flow min-cut theorem, explain why Ford-Fulkerson's running time depends on how augmenting paths are chosen (including a pathological example with edge capacities around 10^9), state the Edmonds-Karp improvement using breadth-first search, and set up a max-flow instance to decide whether a sports team is mathematically eliminated from first place.
Key ideas
- Residual network and augmenting paths (recap):
G_fcontains an edge(u,v)whenever the residual capacityc(u,v) - f(u,v)is strictly positive; an augmenting path is any path fromstotinG_f, and its residual capacity is the minimum edge capacity along it. - Ford-Fulkerson algorithm: start with zero flow; while an augmenting path exists in
G_f, augment the flow by the path's residual capacity; when no augmenting path exists, the flow is maximum. - Max-flow min-cut theorem: three statements are equivalent for a flow
f— some cut is saturated (f = c(S,T)),fis a maximum flow, andfadmits no augmenting path; the lecture proves1 implies 2,2 implies 3, and3 implies 1. - Constructing the saturating cut: given a flow with no augmenting path, the set of vertices reachable from
sinG_fforms one side of a cut whose forward edges are all saturated, which directly proves3 implies 1. - Choice of augmenting path matters: a poorly chosen (depth-first) sequence of augmenting paths can force close to
2 * 10^9iterations on a four-vertex graph with large capacities, even though two iterations suffice with a better choice. - Edmonds-Karp algorithm: choosing the augmenting path by breadth-first search (shortest path by edge count) bounds Ford-Fulkerson to
O(VE)augmentations, giving an overall running time ofO(VE^2). - Faster max-flow algorithms: the lecture briefly surveys the history of improved bounds (Dinic, King-Rao-Tarjan's
O(VE log(E/(V log V) V)), Orlin'sO(VE), and newer work), without covering their proofs. - Baseball elimination via max flow: modeling remaining games between teams as flow-network capacities lets you determine whether a team can still finish in first place, even in cases where simple arithmetic ('wins + remaining games < leader's wins') is not decisive.
Walkthrough
Review and the Ford-Fulkerson algorithm in code (0:00)
The lecture reviews flow networks, cut capacity, and residual networks from the previous session, then writes out the Ford-Fulkerson algorithm explicitly: initialize flow to zero, repeatedly find an augmenting path in the residual network, and augment the flow by its residual capacity until no augmenting path remains. A small worked example (a two-hop network with a bottleneck edge) shows the flow increasing from zero to its maximum in two augmentations.
Statement of the max-flow min-cut theorem (16:10)
The theorem states that three conditions on a flow f are equivalent: f saturates some cut's capacity, f is a maximum flow, and f admits no augmenting path. The lecture explains that proving 3 implies 2 directly is harder than chaining 1 implies 2, 2 implies 3, and 3 implies 1, which together establish the same equivalence and, crucially, justify why Ford-Fulkerson's termination condition (no augmenting path) guarantees optimality.
Proving 1-implies-2 and 2-implies-3 (21:16)
Both directions follow almost immediately from definitions. If a cut is saturated, the flow can't exceed its capacity, so it must be maximum. If an augmenting path exists, its residual capacity is strictly positive, so the flow value could be increased, contradicting maximality — proving that a maximum flow cannot have an augmenting path.
Proving 3-implies-1: constructing the cut (24:18)
This is the heart of the proof. Given a flow with no augmenting path, the lecture defines S as the set of vertices reachable from s in the residual network G_f, and T as everything else; t cannot be in S since there's no augmenting path. For any edge (u,v) in the original graph with u in S and v in T, the absence of a residual edge means the edge must be fully saturated (f(u,v) = c(u,v)), because otherwise v would be reachable and belong to S. Summing over all such edges shows the flow across the cut equals the cut's capacity, completing the proof and explaining why Ford-Fulkerson works.
Running time and a pathological example (36:32)
Because Ford-Fulkerson doesn't specify how to choose augmenting paths, the lecture shows a small four-vertex network with capacities around 10^9 where repeatedly picking paths through the center vertex forces close to two billion iterations, even though the optimal flow requires only two. This motivates the Edmonds-Karp refinement: choosing the augmenting path via breadth-first search (shortest path by number of edges) bounds the algorithm to O(VE) augmentations, each costing O(V+E) for the search, giving O(VE^2) overall. The lecture briefly surveys later improvements (Dinic, King-Rao-Tarjan, Orlin) without proof.
Baseball elimination via max flow (51:45)
Using a modified 1996 American League East standings table, the lecture poses the question of whether a trailing team (Detroit) can still finish in first place given its current wins, losses, and remaining games, including games remaining against each other division rival. A simple check (wins plus remaining games less than the leader's current wins) is shown to be sufficient but not necessary for elimination; a worked example shows a team can be eliminated even when that simple check doesn't trigger. The lecture then builds a flow network where the source connects to nodes representing pairs of teams still to play each other (capacity equal to games remaining between them), those connect to nodes for each individual team (infinite capacity), and each team node connects to the sink with a capacity computed from how many more games it can win without exceeding what the analyzed team could achieve. The team is eliminated exactly when the max flow is strictly less than the total games remaining among the other teams — found here by identifying a min cut of value 25 against a required 26, using the max-flow min-cut theorem rather than running the algorithm step by step.
Before you watch
- Watch the previous 6.046 lecture on flow networks, cuts, and residual networks; this lecture assumes that notation and the definitions of flow value, cut capacity, and augmenting paths.
- Comfort with proof by contradiction and set-based arguments (the implicit summation notation from the prior lecture) is helpful for the max-flow min-cut proof.
Check your understanding
- Walk through the proof that
3 implies 1in the max-flow min-cut theorem: why must every edge from the reachable setStoTbe saturated? - Why can a bad choice of augmenting paths cause Ford-Fulkerson to take a number of iterations proportional to the edge capacities, and how does breadth-first search in Edmonds-Karp avoid this?
- In the baseball elimination construction, what does an edge's capacity from a 'team pair' node to an individual team node represent, and why does saturating all edges out of the source correspond to 'playing all remaining games'?
- Why is 'wins + remaining games < leader's wins' a sufficient but not necessary condition for a team's elimination, and what kind of interaction between other teams can eliminate a team even when this check fails?
Vocabulary
- max-flow min-cut theorem (noun)
- A theorem stating the largest possible flow equals the smallest cut's capacity.
The max-flow min-cut theorem connects two seemingly different quantities. - saturate (verb)
- To fill something completely to its maximum capacity.
A cut is saturated when every crossing edge is at full capacity. - termination condition (noun)
- The rule that tells an algorithm when to stop running.
The termination condition for Ford-Fulkerson is having no augmenting path left. - breadth-first search (BFS) (noun)
- A search method that explores a graph level by level, finding the shortest path by number of edges.
Edmonds-Karp uses breadth-first search to pick the shortest augmenting path. - pathological example (noun)
- An extreme case specifically designed to reveal a weakness in a method.
A pathological example shows Ford-Fulkerson can take far too many steps. - running time (noun)
- The amount of time an algorithm takes to complete, usually measured relative to input size.
Edmonds-Karp improves the running time compared to arbitrary path choice. - elimination (noun)
- Being mathematically unable to achieve a certain outcome, no matter what happens next.
Elimination in baseball means a team cannot possibly finish first. - sufficient condition (noun)
- A condition that guarantees an outcome, though other conditions might also work.
A simple win count check is a sufficient condition for elimination, but not the only one. - residual capacity (noun)
- The amount of extra flow that can still be pushed along an edge.
An augmenting path's residual capacity limits how much flow it can carry. - cut (graph) (noun)
- A split of a graph's vertices into two groups, separating a source from a sink.
A saturated cut proves the current flow is already maximum. - equivalent (adjective)
- Having the same effect or meaning as something else, even if stated differently.
The three statements in the theorem are shown to be equivalent. - reachable (adjective)
- Able to be reached by following a path from a given starting point.
The proof looks at every vertex reachable from the source. - sum over (phrase)
- To add up a quantity across every item in a group.
The proof sums over all saturated edges crossing the cut. - decisive (adjective)
- Settling a question clearly, with no doubt left.
A simple arithmetic check is not always decisive for elimination. - trailing (rival) (adjective)
- Currently behind in a competition or ranking.
The trailing team's elimination is checked using max flow. - standings (noun)
- A table ranking competitors by their current results.
The example uses a real division's standings table. - network (flow) (noun)
- A graph where edges carry a limited amount of flow between a source and a sink.
The baseball problem is modeled as a flow network. - iteration (noun)
- One complete repeat of a step in an algorithm.
Each iteration of Ford-Fulkerson adds more flow along a path. - contradict (verb)
- To go against or disagree with a stated claim.
The extra flow would contradict the assumption of maximality. - instance (problem) (noun)
- One specific example of a general problem, with actual input values.
The lecture builds a specific flow-network instance for the standings. - endpoint (noun)
- One of the two vertices that an edge connects.
Each edge has two endpoints in the graph. - bottleneck (noun)
- The single part of a system that most limits its overall capacity.
The path's bottleneck edge sets the amount of extra flow possible. - worked example (phrase)
- A full example solved step by step to show how a method works.
A worked example shows the flow rising to its maximum in two steps. - eliminated (mathematically) (adjective)
- Unable to reach a goal no matter what happens in the remaining events.
A team is mathematically eliminated once the max flow test fails. - rival (noun)
- A competitor trying to achieve the same goal.
Games remaining against each rival affect the elimination check.
From the YouTube description
MIT 6.046J Design and Analysis of Algorithms, Spring 2015
View the complete course: http://ocw.mit.edu/6-046JS15
Instructor: Srinivas Devadas
In this lecture, Professor Devadas continues with the topic of network flow.
License: Creative Commons BY-NC-SA
More information at http://ocw.mit.edu/terms
More courses at http://ocw.mit.edu
← 13. Incremental Improvement: Max Flow, Min Cut · Recitation 7: Network Flow, Edmonds-Karp, and Matching →
