ps5draft4

ps5draft4 - CS4820 Problem Set 5 Liyuan Gao, lg342 March 7,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS4820 Problem Set 5 Liyuan Gao, lg342 March 7, 2012 Collaborators: Detian Shi and Nicholas Beaumont 1 1 Even more Ford-Fulkerson (1a) Max-flow 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 breadth-first 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 max-flow. 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 breadth-fist 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 s-t-flow such that there is no s-t path in the residual graph G f , then there is an s-t 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 s-t 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 s-t path in f. If there exists an s-t path in f, then by lemma (7 . 3) (quoted below), one step of Ford-Fulkerson 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 breadth-first search finds on termination, then by (7 . 9), we know that G has maximum flow. Similarly, if there is an s-t 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 depth-first 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 for-loop 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.

Page1 / 10

ps5draft4 - CS4820 Problem Set 5 Liyuan Gao, lg342 March 7,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online