title: How to construct Level Graph for Dinic's Algorithm for computing Max Flow?
body: <p>I was reading about <a href="https://en.wikipedia.org/wiki/Dinic%27s_algorithm" rel="nofollow noreferrer">Dinic's Algorithm</a> to solve the Max Flow problem and the algorithm states the following for a graph G given source S and sink T:</p>
  
  <ol>
  <li>Set the flow of every edge to 0</li>
  <li>Construct the level graph GL from Gf (where Gf is residual graph)</li>
  <li>Find blocking flow in GL</li>
  <li>Add augmenting flows and go back to 2</li>
  </ol>
  
  <p>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.</p>
  
  <p>However I do not understand how this is done when there are vertices that are farther away from S than T is from S.</p>
  
  <p>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.</p>
  
  <p>Can someone please help me understand how this is done?</p>
  
  <p>The image:</p>
  
  <p><a href="https://i.stack.imgur.com/HOJbp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HOJbp.jpg" alt="enter image description here"></a></p>