2

I was reading about Dinic's Algorithm to solve the Max Flow problem and the algorithm states the following for a graph G given source S and sink T:

  1. Set the flow of every edge to 0
  2. Construct the level graph GL from Gf (where Gf is residual graph)
  3. Find blocking flow in GL
  4. Add augmenting flows and go back to 2

After some research online I understood how GL is computed provided the T lies on the last level or T is the farthest number of hops away from S.

However I do not understand how this is done when there are vertices that are farther away from S than T is from S.

For example in the image below I understand how to construct GL for the residual graph Gf shown in Diagram 1 however I am unsure as to how to draw the level graph GL for the residual graph shown in Diagram 2.

How can this be done?

The image:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Arat254
  • 449
  • 2
  • 5
  • 17
  • Did you resolve this? I was thinking about this possibility and was wondering if we could simply early-exit the BFS when we get to the target node. My related question: https://cstheory.stackexchange.com/questions/52931/consequences-of-early-exiting-bfs-after-reaching-the-target-node-in-dinics-algo – iheap Jun 11 '23 at 21:35

1 Answers1

0

To compute the level graph, at each step, you have to take all the vertices that do not have any predecessor and then remove these vertices for next step. In your second example, you have hence the following:

  • step 0: S is at level 0 (and remaining graph is the graph induced by vertices A,B,C,D,E,F,T)
  • step 1: A and B are at level 1 (and remaining graph is the graph induced by vertices C,D,E,F,T)
  • step 2: C and D are at level 2 (and remaining graph is the graph induced by vertices E,F,T)
  • step 3: E is at level 3 (and remaining graph is the graph induced by vertices F and T)
  • step 4: F is at level 4 (and remaining graph is the single node T)
  • step 5: T is at level 5

You cannot take T at step 3, because there is still an arc from F to T.

Damien Prot
  • 573
  • 3
  • 7