Bottleneck edge
Standard · Trace the algorithm · about 6 min
Edmonds-Karp runs from s to t. Each time BFS highlights a path, click the bottleneck edge: the path edge with the least room left.
Example 1
Input:
{"edges":[["s","v1",16],["s","v2",13],["v2","v1",4],["v1","v3",12],["v3","v2",9],["v2","v4",14],["v4","v3",7],["v3","t",20],["v4","t",4]],"source":"s","sink":"t"}
Output:
["v1→v3","v4→t","v4→v3"]
The maximum flow is 12 + 4 + 7 = 23.
Constraints
- Labels show the room left, not the capacity, after the first push.
Learn the idea first: Maximum flow: Ford-Fulkerson and Edmonds-Karp, a visual lesson.
More Maximum flow: Ford-Fulkerson and Edmonds-Karp problems
- Why backward edges Warm-up
- Augment by hand Warm-up
- Implement Edmonds-Karp Standard