Why backward edges
Warm-up · Multiple choice · about 3 min
Every edge has capacity 1. The first push sends 1 unit along s → a → b → t. Without backward edges no other path has room. What do backward edges add?
Example 1
Input:
{"edges":[["s","a",1],["s","b",1],["a","b",1],["a","t",1],["b","t",1]],"source":"s","sink":"t"}
Output:
2
The maximum flow is 2: s → a → t and s → b → t.
Learn the idea first: Maximum flow: Ford-Fulkerson and Edmonds-Karp, a visual lesson.
More Maximum flow: Ford-Fulkerson and Edmonds-Karp problems
- Augment by hand Warm-up
- Bottleneck edge Standard
- Implement Edmonds-Karp Standard