Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. int Flow(int Source,int Destination)
  2. {
  3. int F=0,Min;
  4.  
  5. while(BFS(Source,Destination))
  6. {
  7. for(int i=0;i<Graph[Destination].size();i++)
  8. if(capacity[I][Destination]-flow[I][Destination]>0||!visited[I])
  9. {
  10. Min=capacity[I][Destination]-flow[I][Destination];
  11.  
  12. for(int j=I;j!=Source;j=father[j])
  13. if(capacity[father[j]][j]-flow[father[j]][j]<Min)
  14. Min=capacity[father[j]][j]-flow[father[j]][j];
  15. flow[I][Destination]+=Min;
  16. flow[Destination][I]-=Min;
  17. for(int j=I;j!=Source;j=father[j])
  18. flow[father[j]][j]+=Min,flow[j][father[j]]-=Min;
  19. F+=Min;
  20. }
  21. }
  22. return F;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement