This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS4820 Problem Set 5 Liyuan Gao, lg342 March 7, 2012 Collaborators: Detian Shi and Nicholas Beaumont 1 1 Even more FordFulkerson (1a) Maxflow detection. Algorithm: We first construct a residual graph G f of the given input G , which should take no more than O ( n ) time. We then do a breadthfirst traversal from G f starting at node s and terminating when all nodes have been marked or when we hit node t . If we were successful in finding an s t path, then we output NO as G is not maxflow. Otherwise, we output Y ES Complexity: The residual graph G f contains at most 2 m edges and the same set of nodes as G , where m is the number of edges in G , and since the edges in G f can be constructed directly from G , it will take at most O ( m ) time to contruct G f . Since there are only n nodes in G f , then breadthfist search will take O ( m + n ) time, so the total time for the algorithm to run is O ( m + n ). Correctness: We refer to lemma (7 . 9) from the text book, which states that (7.9) If f is an stflow such that there is no st path in the residual graph G f , then there is an st cut ( A * ,B * ) in G for which v ( f ) = c ( A * ,B * ). Consequently, f has the maximum value of any flow in G. Lemma Furthermore, we can claim that if an st path exists in f, then f is not maximum flow. We can alternatively show its converse that if f is maximum flow, then there doesn’t exist an st path in f. If there exists an st path in f, then by lemma (7 . 3) (quoted below), one step of FordFulkerson will produce a more optimal flow, hence rendering f not maximal. hence, if G has no s t path in its residual graph G f , which is what the breadthfirst search finds on termination, then by (7 . 9), we know that G has maximum flow. Similarly, if there is an st path in f, then f cannot be maximum flow by the above lemma. 2 (1b) Flow improvement. Algorithm: As with above, we construct the residual graph G f and run depthfirst search on it starting at s , ending at t , and marking all of the nodes on the path from s to t . Let’s call this path P . Next, we call augment ( P,f ), defined in the book as increasing the flow of the forward edges in path P in G by the bottleneck while decreasing the flow of the backward edges in path P in G by the same amount. Finally, we return the flow f that was returned from augment and terminate. Complexity: Since the first two steps are nearly identical to that of (1 a ), we know that they take O ( m + n ) collectively. Augment first calls bottleneck , which takes O ( m ) time to go through all of the edges on P and find the bottleneck, which takes O ( m ) time, and finally the forloop goes through each of the O ( m ) edges of P again and updates their corresponding entry in f ( e ), which takes constant time. Hence the final runtime is again O ( m + n )....
View
Full
Document
This note was uploaded on 03/12/2012 for the course CS 4820 taught by Professor Kleinberg during the Spring '08 term at Cornell.
 Spring '08
 KLEINBERG
 Algorithms

Click to edit the document details