@@ -39,8 +39,33 @@ whatever place of interest we desire to go. How can we apply this to solving
39
39
for the maximum flow?
40
40
41
41
In this analogy, you are the source and the coffee shop is the sink. The main
42
- idea behind Dinic’s algorithm is to guide augmenting paths from s -> t using a
42
+ idea behind Dinic’s algorithm is to GUIDE augmenting paths from s -> t using a
43
43
level graph, and in doing so greatly reducing the runtime.
44
44
45
+ The way Dinic’s determines which edges make progress towards the sink T and
46
+ which do not is by building what is called a level graph.
47
+
48
+ The levels of the graph are those obtained by doing a BFS from the source.
49
+
50
+ Furthermore, an edge is only part of the level graph if it makes progress
51
+ towards the sink. That is, the edge must go from a node at level L to another
52
+ at level L+1.
53
+
54
+ The requirement that edges must go from L to L+1 prunes backwards and "sideways"
55
+ edges (grey edges in this slide).
56
+
57
+ As yourself, if we're trying to go from s -> t as quickly as possible, does it
58
+ make sense to take the red edge going in the backwards direction?
59
+
60
+ No, taking the red edge doesn’t bring you closer to the sink, so it should only
61
+ be taken if a detour is required. This is why backwards edges are omitted in
62
+ the level graph.
63
+
64
+ The same thing can be said about edges which cut across sideways across the same
65
+ level since no progress is made.
66
+
67
+ It’s also worth mentioning that residual edges can be made part of the level
68
+ graph, but they must have a remaining capacity, greater than 0.
69
+
45
70
46
71
0 commit comments