Docsity

Network Flow: Basic Algorithms - Lecture Slides | CS 473, Study notes of Algorithms and Programming

Partial preview of the text

Download Network Flow: Basic Algorithms - Lecture Slides | CS 473 and more Study notes Algorithms and Programming in PDF only on Docsity!

CS 473ug: Algorithms

Mahesh Viswanathan [email protected] 3232 Siebel Center

University of Illinois, Urbana-Champaign

Spring 2008

Maximum Flow AlgorithmsCorrectness and Analysis Polynomial Time Algorithms

Part I

Network Flow: Basic Algorithms

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Flow Networks

Definition Flow network is an abstraction of a transportation network. It is a directed graph G = (V , E ) with

s

1

2

3

4

5

6

t 15

5

10

30

8

4

9

4 15

6 10

10

15

15 10

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Flow Networks

Definition Flow network is an abstraction of a transportation network. It is a directed graph G = (V , E ) with

s

1

2

3

4

5

6

t 15

5

10

30

8

4

9

4 15

6 10

10

15

(^15 10) Each edge e has a capacity c(e) ≥ 0

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Flow Networks

Definition Flow network is an abstraction of a transportation network. It is a directed graph G = (V , E ) with

s

1

2

3

4

5

6

t 15

5

10

30

8

4

9

4 15

6 10

10

15

(^15 10) Each edge e has a capacity c(e) ≥ 0 Source s ∈ V with no incoming edges Sink t ∈ V with no outgoing edges

Assumptions: All capacities are integer, and every vertex has at least on edge incident to it.

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Flows

Definition A flow in a network G = (V , E ), is a function f : E → R≥^0 such that

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Flows

Definition A flow in a network G = (V , E ), is a function f : E → R≥^0 such that

Capacity Constraint: For each edge e, f (e) ≤ c(e) Conservation Constraint: For each vertex v 6 = s, t ∑

e into v

f (e) =

e out of v

f (e)

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Flows

Definition A flow in a network G = (V , E ), is a function f : E → R≥^0 such that

s

1

2

3

4

5

6

t 14/

4/

10/

14/

8/

0/

9/

0/4 1/

4/6^ 10/

9/

0/

0/15 9/

Figure: Flow with value 28

Capacity Constraint: For each edge e, f (e) ≤ c(e) Conservation Constraint: For each vertex v 6 = s, t ∑

e into v

f (e) =

e out of v

f (e)

Polynomial Time Algorithms Ford-Fulkerson Algorithm

More Definitions and Notation

Notation The inflow into a vertex v is f in(v ) =

e into v f^ (e) and the outflow is f out(v ) =

e out of v f^ (e)

Polynomial Time Algorithms Ford-Fulkerson Algorithm

More Definitions and Notation

Notation The inflow into a vertex v is f in(v ) =

e into v f^ (e) and the outflow is f out(v ) =

e out of v f^ (e) For a set of vertices A, f in(A) =

e into A f^ (e). Outflow f out(A) is defined analogously

Polynomial Time Algorithms Ford-Fulkerson Algorithm

The Maximum-Flow Problem

Problem

Polynomial Time Algorithms Ford-Fulkerson Algorithm

The Maximum-Flow Problem

Problem Input A network G with capacity c and source s and sink t

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Greedy Approach

s

v

u

t 10

20

20

10

30

(^1) Begin with f (e) = 0 for each edge (^2) Find a s-t path P with f (e) < c(e) for every edge e ∈ P (^3) Augment flow along this path (^4) Repeat augmentation for as long as possible.

Polynomial Time Algorithms Ford-Fulkerson Algorithm

Greedy Approach

s

v

u

t 10/

20

10/

10

30

(^1) Begin with f (e) = 0 for each edge (^2) Find a s-t path P with f (e) < c(e) for every edge e ∈ P (^3) Augment flow along this path (^4) Repeat augmentation for as long as possible.