1
votes

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.

Can someone please help me understand how this is done?

The image:

enter image description here

1

1 Answers

0
votes

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.