Docsity

Maximum Flow - Data Structures and Algorithm - Lecture Slides, Slides of Data Structures and Algorithms

Partial preview of the text

Download Maximum Flow - Data Structures and Algorithm - Lecture Slides and more Slides Data Structures and Algorithms in PDF only on Docsity!

Data Structures & Algorithm

Analysis

Maximum Flow and

Minimum Cut

  • Max flow and min cut.
    • Two algorithmic problems.
    • See Cormen et.al for more details
  • Nontrivial applications / reductions.
    • Network connectivity.
    • Traffic control
    • Data mining.
    • Airline scheduling.
    • Project selection.
    • General scheduling
      • Network reliability.
      • Distributed computing.
      • Distributed computing.
      • Many many more...

Flows

• An s-t flow is a function f: E → ā„œ that satisfies:

  • For each e ∈ E: 0 ≤ f(e) ≤ u(e) (capacity)
  • For each v ∈ V – {s, t}: āˆ‘ āˆ‘ (conservation)

e v e v

f e f e

into out of

s

2

3

4

5

6

7

t

Capacity

Flow

āˆ‘ = āˆ‘

e v w v w ∈ E

f e f v w

outof :( , )

āˆ‘ = āˆ‘ ( ) : ( , )

e v w wv ∈ E

f e f w v

into :( , )

( ) : ( , )

Flows

• An s-t flow is a function f: E → ā„œ that satisfies:

  • For each e ∈ E: 0 ≤ f(e) ≤ u(e) (capacity)
  • For each v ∈ V – {s, t}: āˆ‘ āˆ‘ (conservation)

e v e v

f e f e

into out of

s

2

3

4

5

6

7

t

Capacity

Flow

= āˆ‘

e s

f f e

out of

Value = 4

MAX FLOW: find s-t flow that

maximizes net flow out of the source.

Flows

• An s-t flow is a function f: E → ā„œ that satisfies:

  • For each e ∈ E: 0 ≤ f(e) ≤ u(e) (capacity)
  • For each v ∈ V – {s, t}: āˆ‘ āˆ‘ (conservation)

e v e v

f e f e

into out of

= āˆ‘

e s

f f e

out of

MAX FLOW: find s-t flow that

maximizes net flow out of the source.

s

2

3

4

5

6

7

t

Value = 28

Capacity

Flow

Networks Flow Examples

communication

Network

telephone exchanges,

computers, satellites

Nodes Arcs

cables, fiber optics,

microwave relays

Flow

voice, video,

packets

circuits

gates, registers,

processors

wires current

mechanical joints rods, beams, springs heat, energy

hydraulic

reservoirs, pumping

stations, lakes

pipelines fluid, oil

financial stocks, currency transactions money

transportation

airports, rail yards,

street intersections

highways, railbeds,

airway routes

freight,

vehicles,

passengers

chemical sites bonds energy

Cuts

• An s-t cut is a node partition (S, T) such that s ∈ S, t ∈ T.

– The capacity of an s-t cut (S, T) is:

• Min s-t cut: find an s-t cut of minimum

capacity.

s

2

3

4

5

6

7

t

Capacity = 62

āˆ‘ āˆ‘

∈ ∈

∈

=

v S w T

e S vw E

u e u v w

,

outof ( , )

( ) : ( , ).

Cuts

• An s-t cut is a node partition (S, T) such that s ∈ S, t ∈ T.

– The capacity of an s-t cut (S, T) is:

• Min s-t cut: find an s-t cut of minimum

capacity.

s

2

3

4

5

6

7

t

Capacity = 28

āˆ‘ āˆ‘

∈ ∈

∈

v S w T

e S vw E

u e u v w

,

outof ( , )

Flows and Cuts

• L1. Let f be a flow, and let (S, T) be a cut. Then, the net

flow sent across the cut is equal to the amount reaching t.

s

2

3

4

5

6

7

t

Value = 24

f e f e f e f

e S e S e s

āˆ‘ āˆ’^ āˆ‘ = āˆ‘^ =

outof into outof

Flows and Cuts

• L1. Let f be a flow, and let (S, T) be a cut. Then, the net flow

sent across the cut is equal to the amount reaching t.

s

2

3

4

5

6

7

t

Value = 24

f e f e f e f

e S e S e s

āˆ‘ āˆ’^ āˆ‘ = āˆ‘^ =

outof into outof

Flows and Cuts

• L2. Let f be a flow, and let (S, T) be a cut. Then,

| f | ≤ cap(S, T).

• Proof.

• Corollary. Let f be a flow, and let (S, T) be a cut.

If |f| = cap(S, T), then f is a max flow and (S, T) is a min cut.

cap(S, T)

outof

outof

outof into

āˆ‘

āˆ‘

āˆ‘ āˆ‘

e S

e S

e S e S

u e

f e

f f e f e

s

t

S T

Max Flow and Min Cut

• Corollary. Let f be a flow, and let (S, T) be a

cut. If |f| = cap(S, T), then f is a max flow and

(S, T) is a min cut.

s

2

3

4

5

6

7

t

Flow value = 28

Cut capacity = 28

Max-Flow Min-Cut Theorem

• Intuitive Proof:

• Lemma 2  | f | ≤ cap(S, T).

– Max for |f| is a certain cut C where Max|f| = C

– Min cut for cap(S,T) is a certain flow F where

|f| = Min cut

– |f| ≤ Max |f| = C ≄ Min cut(S,T) 

– Max |f| ≄ Min cut(S,T)

– L2  Max |f| ≤ Min cut(S,T)

–  Max |f| = Min cut(S,T)