Flow Network Talk

17
Flow Networks Imane Hafnaoui M’Hamed Bouguara University - Boumerdes Institute of electricity and electronics 2011 - 2012 Talk presented by

description

 

Transcript of Flow Network Talk

Page 1: Flow Network Talk

Flow Networks

Imane Hafnaoui

M’Hamed Bouguara University - BoumerdesInstitute of electricity and electronics

2011 - 2012

Talk presented by

Page 2: Flow Network Talk

OUTILINES

1. Introduction2. Max Flow Problem3. Residual Network4. Augmenting Path5. Flow and Cut6. Max Flow – Min Cut Theorem7. Ford-Fulkerson Algorithm

Page 3: Flow Network Talk

Introduction

1. Flow Network Definition It is a weighted directed graph G=(V,E) where every edge has a non-negative weight called capacity and receives a flow on each edge.

It has two distinguished vertices s and t (source and sink) such that s has no incoming edges and t has no outgoing edges.

Application:Flow networks can be used to model traffic in roads, fluids flow in pipes, current flow in electrical systems, etc

Page 4: Flow Network Talk

Introduction

2. Flow definitionIt is a function f : V x V → R that

satisfieso Capacity constraint

o Flow conservation : for u, v Є V- {s,t}

The value of the flow, denoted |f|, is the total flow from the source s; and in the same way, to the sink t.

Page 5: Flow Network Talk

Max Flow Problem

Given a network G, a flow is said to be maximum if |f| is the largest of all flows in G.

The Max Flow Problem consists of finding the maximum feasible flow from s to t without violating any capacity constraints.

| f | max = 4 + 3 + 3 = 10

Page 6: Flow Network Talk

Ford-Fulkerson Method

• This method covers many implementations with differing running times and depends on three important ideas:

a. Residual Networkb. Augmenting pathc. Cuts

In this talk, only the Ford-Fulkerson Algorithm will be discussed which depends itself on the three previously mentioned concepts.

Page 7: Flow Network Talk

Residual NetworkGiven a network G = (V, E) with flow f, a residual network Gf (V, Ef) is a graph with residual capacities such that:

It introduces reverse edges where increase in flow in one direction is not possible or a decrease is necessary.

Example:

u v6 / 17

CapacityFlow

u v

11

6

Page 8: Flow Network Talk

Lemma

• Given a network G (V, E) and its residual network Gf (V, Ef),

|Ef| 2 |E|

ProofThat is each residual edge can admit a flow f >

0. The edges in Ef are either edges in E or their reversals.

Thus, |Ef| 2 |E|

Page 9: Flow Network Talk

Augmenting Path

Given a flow network G and a flow f, an augmenting path p is a path from s to t in the residual network Gf

We define the residual capacity of the path cf(p) as the max amount by which we can increase the flow, where:

cf (p) = min {cf (u,v) : (u, v) ∈ p}

Page 10: Flow Network Talk

Flow Augmentation

LemmaLet f p be the flow in Gf defined

And we augment f by f p . The augmented flow f ‘ is

| f ‘| = | f | + | f p|> | f |

Page 11: Flow Network Talk

Cuts• A cut (S, T) = ( Vs, Vt) of a

network G(V, E) is a partition of the vertices in V such that s ∈ VS and t ∈ Vt

Forward edge of cut : origin in Vs and destination in Vt

Backward edge of cut: origin in Vt and destination in Vs

• Flow f (S, T) across a cut:

• Capacity C(S, T) of a cut:

C(S, T) = 24f (S, T) = 8

Page 12: Flow Network Talk

CutsLemma

f (S, T) = | f |TheoremThe value of any flow is bounded

from the above by the capacity of any cut:

| f | c(S,T)Proof

Page 13: Flow Network Talk

Max Flow Min Cut Theorem

If f is a flow in a flow network G = (V, E) with source s and sink t , then The value of the max flow is equal to the value of the min cut.

Proof: The following conditions are equivalent:

1. | f | is a maximum flow in G.2. The residual network Gf has no augmenting

paths.3. | f | = C(S,T) (min cut)

Page 14: Flow Network Talk

Proof

• (1) (2): we assume | f | is a max flow. If an augmenting path exists then by the equation

| f ‘| = | f | + | f p| the augmented flow | f ‘| is strictly greater than | f |. Hence, the assumption is wrong.

• (2) (3): Suppose that Gf has no augmenting path (no path from s to t). Consider a cut (S,T) s.t.

S = {v ∈ V: there exists a path from s to v in Gf } and

T = V-S. Let u ∈ S and v ∈ T.

Page 15: Flow Network Talk

Proof

we must have f(u, v) = c(u, v) since otherwise (u, v) ∈ Ef , which would place v in set S.

By lemma, f (S, T) = | f | = C(S,T)

• (3) (1): By theorem, we have | f | c(S,T). So if | f | = C(S,T), it implies that | f | is maximum flow.

Page 16: Flow Network Talk

Ford-Fulkerson Algorithm

FORD-FULKERSON(G; s; t) for each edge (u, v) ∈ G(V, E) do

f (u, v) = 0

while G has an augmenting path p do cf (p) = min {cf (u,v) : (u, v) ∈ p}

for each edge (u, v) in p do if (u, v) ∈ E

f (u, v) = f (u, v) + cf (p)

elsef (v, u) = f (v, u) - cf (p)

...

end.

Page 17: Flow Network Talk

Thanks For Your Attention