Quiz: graphs, cuts and maximum flow
Before this unit: Segmentation as energy minimisation (previous unit); Day 12: Thresholding.
See also: Day 13: Morphology; Day 15: Watershed.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. A graph has nodes s, a, b, t. How many s–t cuts does it have? List them.
s is always in S and t always in T. Each other node can go either way.
2^2 = 4: S = \{s\}, \{s, a\}, \{s, b\}, \{s, a, b\} (and T is the rest).
Q2. The edge b \to a has capacity 7. In the cut S = \{s, a\}, T = \{b, t\}, does it count?
Which direction does it cross?
No. It goes from T (b) to S (a). Only edges from S to T count in the cost of the cut.
Q3. Someone claims a flow of value 12 in a graph that has a cut of cost 10. Why must they be wrong?
All flow from s to t has to pass the cut.
Every unit of flow from s to t crosses the cut from S to T, through edges whose capacities add up to 10. Flow coming back from T to S only lowers the net amount. So every flow has value at most 10.
Q4. The flow on u \to v is 3, its capacity 5. Which arcs does the residual graph have between u and v, and with which capacities?
One arc for room left, one for flow that can be undone.
A forward arc u \to v with residual capacity 5 - 3 = 2, and a backward arc v \to u with residual capacity 3. Pushing along the backward arc reduces the flow on u \to v.
Q5. Ford–Fulkerson stops when there is no path from s to t in the residual graph. How do you read off a minimum cut?
Which nodes can you still reach?
S = the nodes reachable from s in the final residual graph, T = the rest. Every edge from S to T is full, and every edge from T to S carries no flow, so the cut cost equals the flow value: both are optimal.
Q6. All capacities are integers. Why does Ford–Fulkerson stop, and why is the final flow on every edge an integer?
What is the bottleneck of a path if all residual capacities are integers?
If all flows are integers, all residual capacities are integers, so every bottleneck is a positive integer, at least 1, and the new flows are integers again. Each step raises the flow by at least 1 and the flow cannot exceed the (finite) capacity of any cut, so the algorithm stops after at most that many steps.
Q7. A graph has two different minimum cuts. You raise the capacity of one edge of the first cut. Does the maximum flow increase?
Max-flow = min-cut. What is the minimum cut after the change?
No. The second cut still has the same cost, and the flow can be no larger than it. To raise the maximum flow, every minimum cut must get more capacity.
Q8. An image has 10^6 pixels and each pixel is a node. Why is enumerating all cuts out of the question, and roughly how large is the graph that max-flow has to handle?
Count cuts, then count edges per node.
There are 2^{10^6} cuts. The graph, however, has only 10^6 + 2 nodes and a few edges per node (4 neighbours, plus one edge to s and one to t), so a few million edges. Max-flow algorithms work on that directly, in time polynomial in the size of the graph; on image graphs this typically takes about a second or less.