# Updating maximum flow

We can initialize the residual graph as original graph as there is no initial flow and initially residual capacity is equal to original capacity.To find an augmenting path, we can either do a BFS or DFS of the residual graph. Using BFS, we can find out if there is a path from source to sink. Using the parent[] array, we traverse through the found path and find possible flow through this path by finding minimum residual capacity along the path. The important thing is, we need to update residual capacities in the residual graph.Other sections discuss the augmenting path algorithms themselves.The last section shows results of a practical analysis and highlights the best in practice algorithm.BFS(source, sink, parent) : # Find minimum residual capacity of the edges along the # path filled by BFS.Or we can say find the maximum flow # through the path found. = source): path_flow = min (path_flow, self.graph[parent[s[s]) s = parent[s] # Add path flow to overall flow max_flow = path_flow # update residual capacities of the edges and reverse edges # along the path v = sink while(v !

||We can initialize the residual graph as original graph as there is no initial flow and initially residual capacity is equal to original capacity.

To find an augmenting path, we can either do a BFS or DFS of the residual graph. Using BFS, we can find out if there is a path from source to sink. Using the parent[] array, we traverse through the found path and find possible flow through this path by finding minimum residual capacity along the path. The important thing is, we need to update residual capacities in the residual graph.

Other sections discuss the augmenting path algorithms themselves.

The last section shows results of a practical analysis and highlights the best in practice algorithm.

]]If there is a path from source to sink in residual graph, then it is possible to add flow.We subtract path flow from all edges along the path and we add path flow along the reverse edges We need to add path flow along reverse edges because may later need to send flow in reverse direction (See following link for example). Following are C and Java implementations of Ford-Fulkerson algorithm.a) Flow on an edge doesn’t exceed the given capacity of the edge.b) Incoming flow is equal to outgoing flow for every vertex except s and t.

Expert after expert has said that as many as 2.5 million people who have jobs today would not have had them if we hadn’t acted.