Updating maximum flow

Posted by / 23-Sep-2014 00:43

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.

updating maximum flow-70updating maximum flow-37updating maximum flow-19

One thought on “updating maximum flow”