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

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

View Full Document Right Arrow Icon
CS4820 Problem Set 5 Liyuan Gao, lg342 March 7, 2012 Collaborators: Detian Shi and Nicholas Beaumont 1
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 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 0 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 ). Correctness What we have done is essentially perform the first step of Ford-Fulkerson. By the converse of (7 . 9), we know that since our flow f isn’t maximal, then there must be at least one s - t path in the residual graph G f . Once we find this path P , we can then show, using lemma (7 . 3) from the book, that f 0 is more maximal than f , or that v ( f 0 ) > v ( f ).
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern