Docsity

Network Flow: Ford-Fulkerson Algorithm and Capacity Scaling, Study notes of Computer Science

Partial preview of the text

Download Network Flow: Ford-Fulkerson Algorithm and Capacity Scaling and more Study notes Computer Science in PDF only on Docsity!

11/14/

A. Smith; based on slides by K. Wayne and S. Raskhodnikova

A. Smith

Algorithm Design and Analysis

L

ECTURE

• Network Flow

augmenting pathsChoosing good

Capacity scaling algorithm

Pre-break: Ford-Fulkerson

Find max

s-t

flow & min

s-t

cut in

O(mnC)

time

All capacities are integers

C

(Today: removing this assumption)

Duality

: Max flow value = min cut capacity

Integrality

: if capacities are integers, then FF

algorithm produces an integral max flow

10/22/

A. Smith; based on slides by S. Raskhodnikova and K. Wayne

Ford-Fulkerson Summary

Ford-Fulkerson:

  • 

While

you can,

  •  Greedily push flow
  •  Update residual graph

Theorem:

FF algorithm terminates with a maximum flow.

Two big ideas:

a)  Max flow

 min cut

b)  Value(FF output flow) = capacity(some cut)

Proof of (b):Hence… FF flow is maximal and the corresponding cut is minimal.

  • 

f = flow output by FF algorithm

  • 

from s in residual graph GfA = set of vertices reachable

  • 

Lemma:

value(f) = capacity(A)

(see Lecture 22)

original network

s

t

A

B

1

X

X

X

1

0

1

Ford-Fulkerson: Exponential Number of Augmentations

Q.

Is generic Ford-Fulkerson algorithm polynomial in input size?

A.

No. If max capacity is C, then algorithm can take C iterations.

s

(^21)

t

C

C 0

0

0

0

0

C

C

1

s

(^21)

t

C

C

1

0

0

0

0

0 X

C

C

X

X

X

1

1

1

X

X

1

1

m, n, and log C

Capacity Scaling

flow by max possible amount.Intuition. Choosing path with highest bottleneck capacity increases 

Don't worry about finding exact highest bottleneck path.



Maintain scaling parameter



Let G

f (^) (  ) be the subgraph of the residual graph consisting of only

arcs with capacity at least

110

s

2 4

t

1

170

102

122

G f

110

s

2 4

t

170

102

122

G f (100)

Capacity Scaling

Scaling-Max-Flow(G,

s,

t,

c)

{

foreach

e



E

f(e)



0





smallest power of 2 greater than or equal to C

G f 

residual graph

while

( 



  1. {

G f (  )  

-residual graph

while

(there

exists

augmenting

path

P

in

G f (  )) {

f



augment(f,

c,

P)

// augment flow by





update G

f (  )

 }





/ 2

return}

f

}

Capacity Scaling: Running Time

Lemma 1. The outer while loop repeats 1 +

log

2 (^) C  (^) times.

Pf. Initially C

< 2C.

(^) decreases by a factor of 2 each iteration.

Lemma 2. Let f be the flow at the end of a

-scaling phase. Then the

value of the maximum flow f* is at most v(f) + m

(Sanity check: |v(f*) – v(f)|

m  , and

(^) shrinks,

so v(f) converges towards v(f*) )

Lemma 3. There are at most 2m augmentations per scaling phase. 

Let f be the flow at the end of the previous scaling phase.



Lemma 2

v(f*)

v(f) + m (



Each augmentation in a

-phase increases v(f) by at least

augmentations. It can be implemented to run in O(m Theorem. The scaling max-flow algorithm finds a max flow in O(m log C)

(^2) log C) time.^

proof on next slide

(Why?)

Capacity Scaling: Running Time

Lemma 2. Let f be the flow at the end of a

-scaling phase. Then value

of the maximum flow is at most v(f) + m

Pf.

(almost identical to proof of max-flow min-cut theorem)



We show that at the end of a

-phase, there exists a cut (A, B)

such that cap(A, B)

v(f) + m



Choose A to be the set of nodes reachable from s in G

f (  ).



By definition of A, s

A.



By definition of f, t

A.

So v(f*)-v(f)

(^) cap(A,B) – v(f)

m



original network

s

t

A

B