keymasterviriya1150

Edmonds-Karp (EK) Algorithm

Apr 18th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. void EK(Graph G, Node s, Node t)
  2. {
  3.     change G into residual graph Gf;
  4.     maxflow = 0;
  5.     while (can find an augmented SHORTEST path P in Gf)
  6.     {
  7.         bottleneck b = minimum of edge weights in P;
  8.         augment flow along P in Gf using b;
  9.  
  10.         maxflow += bottleneck;
  11.     }
  12.  
  13.     print maxflow;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment