Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
PS5 Draft

PS5 Draft

Ratings: (0)|Views: 33 |Likes:
Published by Lee Gao
Algorithms PS5 - Maximum Flow analysis and applications
Algorithms PS5 - Maximum Flow analysis and applications

More info:

Published by: Lee Gao on Mar 09, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/17/2013

pdf

text

original

 
CS4820 Problem Set 5
Liyuan Gao, lg342March 7, 2012Collaborators: Detian Shi and Nicholas Beaumont1
 
1 Even more Ford-Fulkerson
(1a) Max-flow detection.
Algorithm:We first construct a residual graph
G
of the given input
G
, which shouldtake no more than
O
(
n
) time. We then do a breadth-first traversal from
G
starting at node
s
and terminating when all nodes have been marked orwhen we hit node
t
. If we were successful in finding an
s
t
path, then weoutput
NO
as G is not max-flow. Otherwise, we output
Y E
Complexity: The residual graph
G
contains at most 2
m
edges and thesame set of nodes as
G
, where
m
is the number of edges in
G
, and since theedges in
G
can be constructed directly from
G
, it will take at most
O
(
m
)time to contruct
G
.Since there are only
n
nodes in
G
, then breadth-fist search will take
O
(
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 theresidual graph
G
, then there is an s-t cut (
A
,B
) in G forwhich
v
(
) =
c
(
A
,B
). Consequently, f has the maximumvalue of any flow in G.hence, if 
G
has no
s
t
path in its residual graph
G
, which is what thebreadth-first search finds on termination, then by (7
.
9), we know that
G
has maximum flow.
(1b) Flow improvement.
Algorithm:As with above, we construct the residual graph
G
and run depth-firstsearch on it starting at
s
, ending at
t
, and marking all of the nodes on thepath from
s
to
t
. Let’s call this path
.Next, we call
augment
(
P,
), defined in the book as increasing the flow of the forward edges in path
in
G
by the bottleneck while decreasing theflow of the backward edges in path
in
G
by the same amount.Finally, we return the flow
that was returned from augment andterminate.2
 
Complexity: Since the first two steps are nearly identical to that of (1
a
), weknow that they take
O
(
m
+
n
) collectively.
Augment
first calls
bottleneck
,which takes
O
(
m
) time to go through all of the edges on
and find thebottleneck, which takes
O
(
m
) time, and finally the for-loop goes througheach of the
O
(
m
) edges of 
again and updates their corresponding entry in
(
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
isn’t maximal, then there must be at least one
s
t
path in the residualgraph
G
. Once we find this path
, we can then show, using lemma (7
.
3)from the book, that
is more maximal than
, or that
v
(
)
> v
(
).
(7.3)
Let
be a flow in G, and let
be a simple s-t path in
G
, then
v
(
) =
v
(
) +
bottleneck
(
P,
); and since
bottleneck
(
P,
)
>
0, we have
v
(
)
> v
(
).Hence, the
returned by our algorithm will always be more optimal than
.3

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->