• Keine Ergebnisse gefunden

Flow Network

N/A
N/A
Protected

Academic year: 2021

Aktie "Flow Network"

Copied!
7
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

25. Flow in Networks

Flow Network, Maximal Flow, Cut, Rest Network, Max-flow Min-cut Theorem, Ford-Fulkerson Method, Edmonds-Karp Algorithm, Maximal Bipartite Matching [Ottman/Widmayer, Kap. 9.7, 9.8.1], [Cormen et al, Kap. 26.1-26.3]

719

Motivation

Modelling flow of fluents, components on conveyors, current in electrical networks or information flow in communication networks.

720

Flow Network

Flow networkG= (V, E, c): directed graph withcapacities

Antiparallel edges forbidden:

(u, v) ∈E ⇒ (v, u)6∈ E. Model a missing edge(u, v)by c(u, v) = 0.

Sourcesandsinkt: special nodes.

Every nodev is on a path betweens andt: s v t

s

v1

v2

v3

v4

t 16

13

12

14

20

4

4 9 7

721

Flow

A Flowf : V ×V → Rfulfills the following conditions:

Bounded Capacity:

For allu, v∈ V: 0≤f(u, v) ≤ c(u, v). Conservation of flow:

For allu∈V \ {s, t}: X

vV

f(v, u)−X

vV

f(u, v) = 0.

s

v1

v2

v3

v4

t 16/8

13/10

12/12

14/10

20/14

4/4 9/4

4/4 7/6

Valueof the flow:

w(f) =P

vVf(s, v)P

vV f(v, s).

Herew(f) = 18.

722

(2)

How large can a flow possibly be?

Limiting factors: cuts

cut separatingsfromt: Partition ofV intoS andT withs∈S, t ∈T.

Capacityof a cut: c(S, T) =P

vS,v0Tc(v, v0) Minimal cut: cut with minimal capacity.

Flow over the cut: f(S, T) =P

vS,v0T f(v, v0)−P

vS,v0Tf(v0, v)

723

How large can a flow possibly be?

For each flow and each cut it holds thatf(S, T) =w(f):

f(S, T) = X v∈S,v0∈T

f(v, v0) X v∈S,v0∈T

f(v0, v)

= X

vS,v0V

f(v, v0) X vS,v0S

f(v, v0) X vS,v0V

f(v0, v) + X vS,v0S

f(v0, v)

= X

v0∈V

f(s, v0) X v0∈V

f(v0, s) Second equality: amendment, last equality: conservation of flow.

s

v1

v2

v3

v4

t 16/8

13/10

12/12

14/10

20/14

4/4 9/4

4/4 7/6

724

Maximal Flow ?

In particular, for each cut(S, T) ofV. f(S, T) ≤ X

vS,v0T

c(v, v0) =c(S, T)

Will discover that equality holds forminS,Tc(S, T).

s

v1

v2

v3

v4

t 16

13

12

14

20

4

4 9 7

Maximal Flow ?

Naive Procedure

s

v1

v2

v3

v4

t 16/8

13/10

12/12

14/10

20/14

4/4 9/4

4/4 7/6 s

v1

v2

v3

v4

t 16/8

13/11

12/12

14/11

20/15

4/4 9/4

4/4 7/7

s

v1

v2

v3

v4

t 16/8

13/13

12/12

14/11

20/17

4/4 9/2

4/4 7/7 s

v1

v2

v3

v4

t 16/10

13/13

12/12

14/11

20/19

4/4 9/0

4/2 7/7

Conclusion: greedy increase of flow does not solve the problem.

(3)

The Method of Ford-Fulkerson

Start withf(u, v) = 0for allu, v∈ V

Determine rest network*Gf and expansion path inGf Increase flow via expansion path*

Repeat until no expansion path available.

*Will now be explained

727

Increase of flow, negative!

Let some flowf in the network be given.

Finding:

Increase of the flow along some edge possible, when flow can be increased along the edge,i.e. iff(u, v) < c(u, v).

Rest capacitycf(u, v) =c(u, v)−f(u, v).

Increase of flowagainst the directionof the edge possible, if flow can be reduced along the edge, i.e. iff(u, v) > 0.

Rest capacitycf(v, u) =f(u, v).

728

Rest Network

Rest networkGf provided by the edges with positive rest capacity:

s

v1

v2

v3

v4

t 16/8

13/10

12/12

14/10

20/14

4/4 9/4

4/4 7/6

s

v1

v2

v3

v4

t 8

8

3 10

12

4 10

6 14

4 5

4

4 1 6

Rest networks provide the same kind of properties as flow networks with the exception of permitting antiparallel edges

729

Observation

Theorem

LetG = (V, E, c) be a flow network with sourcesand sinktandf a flow inG. LetGf be the corresponding rest networks and letf0be a flow inGf. Thenf ⊕f0defines a flow in Gwith valuew(f) +w(f0).

(f ⊕f0)(u, v) =

(f(u, v) +f0(u, v)−f0(v, u) (u, v) ∈E

0 (u, v) 6∈E.

730

(4)

Proof

Limit of capacity:

(f ⊕f0)(u, v) =f(u, v) +f0(u, v)−f0(v, u)

≥ f(u, v) +f0(u, v)−f(u, v) =f0(u, v) ≥ 0 (f ⊕f0)(u, v) =f(u, v) +f0(u, v)−f0(v, u)

≤ f(u, v) +f0(u, v)

≤ f(u, v) +cf(u, v)

= f(u, v) +c(u, v)−f(u, v) =c(u, v).

731

Proof

Conservation of flow X

u∈V

(f ⊕f0)(u, v) =X

u∈V

f(u, v) +X

u∈V

f0(u, v)−X

u∈V

f0(v, u)

(Flow conservation offandf0)= X

uV

f(v, u) +X

uV

f0(v, u)−X

uV

f0(u, v)

= X

u∈V

(f ⊕f0)(v, u)

732

Beweis

Value off ⊕f0 (in the sequelN+ :=N+(s),N :=N(s)):

w(ff0) = X

vN+

(ff0)(s, v) X

vN

(ff0)(v, s)

= X

vN+

f(s, v) +f0(s, v)f0(v, s) X

vN

f(v, s) +f0(v, s)f0(s, v)

= X

v∈N+

f(s, v) X

v∈N

f(v, s) + X

v∈N+∪N

f0(s, v) + X

v∈N+∪N

f0(v, s)

=X

vV

f(s, v)X

vV

f(v, s) +X

vV

f0(s, v) +X

vV

f0(v, s)

=w(f) +w(f0).

Flow in G

f

expansion pathp: path fromstotin the rest network Gf. Rest capacitycf(p) = min{cf(u, v) : (u, v)edge inp} Theorem

The mappingfp :V ×V → R,

fp(u, v) =

(cf(p) if(u, v)edge inp 0 otherwise

provides a flow inGf with valuew(fp) =cf(p) >0. [Proof: exercise]

(5)

Consequence

Strategy for an algorithm:

With an expansion pathpin Gf the flowf ⊕fp defines a new flow with valuew(f ⊕fp) =w(f) +w(fp) > w(f)

735

Max-Flow Min-Cut Theorem

Theorem

Letf be a flow in a flow networkG = (V, E, c) with sourcesand sinkt. The following statementsa are equivalent:

1 f is a maximal flow inG

2 The rest networkGf does not provide any expansion paths

3 It holds thatw(f) =c(S, T) for a cut(S, T) of G.

736

Proof

(3) ⇒ (1):

It holds thatw(f) ≤c(S, T) for all cutsS, T. Fromw(f) =c(S, T) it follows thatw(f) is maximal.

(1) ⇒ (2):

f maximal Flow inG. Assumption: Gf has some expansion path w(f ⊕fp) =w(f) +w(fp) > w(f). Contradiction.

737

Proof (2) ⇒ (3)

Assumption:Gf has no expansion path. Define

S={vV : there is a paths vinGf}.(S, T) := (S, V \S)is a cut:

sS, t6∈S. LetuSandvT.

If(u, v)E, thenf(u, v) =c(u, v), otherwise it would hold that(u, v)Ef. If(v, u)E, thenf(v, u) = 0, otherwise it would hold that

cf(u, v) =f(v, u)>0and(u, v)Ef

If(u, v)6∈Eand(v, u)6∈E, thenf(u, v) =f(v, u) = 0. Thus

w(f) =f(S, T) =X

u∈S

X

v∈T

f(u, v)X

v∈T

X

us

f(v, u)

=X

uS

X

vT

c(u, v)X

vT

X

us

0 =X

uS

X

vT

c(u, v) =c(S, T).

738

(6)

Algorithm Ford-Fulkerson( G, s, t )

Input : Flow networkG= (V, E, c) Output : Maximal flow f.

for (u, v)E do f(u, v)0

whileExists path p:s tin rest networkGf do cf(p)min{cf(u, v) : (u, v)p}

foreach(u, v)pdo if (u, v)E then

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

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

739

Analysis

The Ford-Fulkerson algorithm does not necessarily have to converge for irrational capacities. For integers or rational numbers it terminates.

For an integer flow, the algorithms requires maximallyw(fmax) iterations of the while loop.

Search a single increasing path (e.g. with DFS or BFSO(|E|)) ThereforeO(fmax|E|).

s

u

v

t 1000

1000 1

1000

1000

With an unlucky choice the al- gorithm may require up to 2000 iterations here.

740

Edmonds-Karp Algorithm

Choose in the Ford-Fulkerson-Method for finding a path inGf the expansion path of shortest possible length (e.g. with BFS)

Edmonds-Karp Algorithm

Theorem

When the Edmonds-Karp algorithm is applied to some integer valued flow networkG = (V, E) with sourcesand sinktthen the number of flow increases applied by the algorithm is inO(|V| · |E|) [Without proof]

(7)

Application: maximal bipartite matching

Given: bipartite undirected graphG = (V, E).

MatchingM: M ⊆E such that|{m∈ M : v ∈ m}| ≤1for allv ∈ V. Maximal MatchingM: MatchingM, such that|M| ≥ |M0| for each matchingM0.

743

Corresponding flow network

Construct a flow network that corresponds to the partitionL, Rof a bipartite graph with sourcesand sinkt, with directed edges froms toL, fromLto R and fromR tot. Each edge has capacity1.

L R

s t

L R

744

Integer number theorem

Theorem

If the capacities of a flow network are integers, then the maximal flow generated by the Ford-Fulkerson method provides integer numbers for eachf(u, v),u, v ∈V.

[without proof]

Consequence: Ford-Fulkerson generates for a flow network that corresponds to a bipartite graph a maximal matching

M ={(u, v) :f(u, v) = 1}.

745

Referenzen

ÄHNLICHE DOKUMENTE

For the gathered packets and events, we have monitored two relevant performance metrics, which are the number of processed packets inside each window and the required time to

A Media Flow is a normal Flow of media packets. There are no mandatory fields, as these Flows may also be exported by standard IPFIX devices not extended for SIP related monitoring

Network flow analysis is employed to effect local optimizations and then dynamic programming ideas are introduced in order to piece the local solutions together into an optimal

Definition: A single source – single sink network is a connected digraph that has a distinguished vertex called the source with nonzero outdegree and a distinguished vertex called

If there is a u-v separating set that contains a vertex adjacent to both vertices u and v, then Assertion 5.3.4a guarantees the existence of k internally disjoint u-v paths in G..

The pulsed Doppler in the measuring set-up used here is based on the relationship between power spectrum for the Doppler spectrum and the velocity distribution for the red cells..

Comprehensive computer-based systems developed originally not in stock exchanges, but in over-the-counter markets, notably the foreign exchange market, from the

Keywords Combinatorial optimization · Network design · OLED · Algorithm engineering · Matrix decompositionM.