Maximum Flow The Maximum Flow Problem Given Directed graph G = ( V - - PowerPoint PPT Presentation

maximum flow the maximum flow problem
SMART_READER_LITE
LIVE PREVIEW

Maximum Flow The Maximum Flow Problem Given Directed graph G = ( V - - PowerPoint PPT Presentation

Maximum Flow The Maximum Flow Problem Given Directed graph G = ( V , E ) A capacity function c : E R + Two vertices s and t . s , t -Flow Function f : E R + such that f ( e ) c ( e ) , for all v V


slide-1
SLIDE 1

Maximum Flow

slide-2
SLIDE 2

The Maximum Flow Problem

Given

◮ Directed graph G = (V, E) ◮ A capacity function c: E → R+ ◮ Two vertices s and t.

s, t-Flow

◮ Function f : E → R+ such that ◮ f (e) ≤ c(e), ◮ for all v ∈ V \ {s, t},

  • uv∈E

f (uv) =

  • vw∈E

f (vw),

  • vs∈E

f (vs) = 0, and

  • tv∈E

f (tv) = 0. The value |f | of an s, t-flow f is

  • sv∈E

f (s, v)

2 / 12

slide-3
SLIDE 3

The Maximum Flow Problem

Maximum Flow Problem For a given directed graph and two given vertices s and t, find an s, t-flow f with maximum value. Multi-Source and Multi-Sink Flow

◮ Sources: s1, s2, . . . , sk ◮ Sinks: t1, t2, . . . , tl ◮ Add vertex s′ and edges s′si with c(s′si) = ∞ (1 ≤ i ≤ k). ◮ Add vertex t′ and edges (tit′) with c(tit′) = ∞ (1 ≤ i ≤ l). ◮ Find maximum s′, t′-flow.

3 / 12

slide-4
SLIDE 4

Max Flow Algorithm

“Naive” Approach

◮ Find some path P from s to t where each edge e has f (e) < c(e). ◮ Add increase f (e) as much as possible for each edge of P. ◮ Repeat.

This approach will not always create an optimal solution s t

1 | 1 0 | 1 1 | 1 0 | 1 1 | 1

algorithm output s t

1 | 1 1 | 1 0 | 1 1 | 1 1 | 1

  • ptimal solution

4 / 12

slide-5
SLIDE 5

Residual Graph

Observation

◮ If f (uv) = k, we can assume there is an augmented edge vu with

c(vu) ≥ k, even if vu / ∈ E. Residual Graph Gf = (V, Ef )

◮ Ef = {uv | uv ∈ E, f (uv) < c(uv)} ∪ {vu | uv ∈ E, f (uv) > 0} ◮ cf (uv) =

  • c(uv) − f (uv)

if uv ∈ E f (vu) if vu ∈ E f ′ is an s, t-flow for Gf if and only if f + f ′ is an s, t-flow for G.

5 / 12

slide-6
SLIDE 6

Ford-Fulkerson Algorithm

Ford-Fulkerson Algorithm

◮ Start with f (e) = 0 for all edges e ∈ E. ◮ Find a simple s, t-path P in Gf . ◮ Update f with maximum flow for P. ◮ Update Gf . ◮ Repeat.

What is the worst case runtime for this algorithm?

6 / 12

slide-7
SLIDE 7

Ford-Fulkerson Algorithm – Runtime

Consider the following case: s u v t 1,000 1,000 1 1,000 1,000 If the algorithm picks uv or vu in each iteration, it takes 2,000 iterations to find a maximum flow. Worst case runtime

◮ If c: E → N, O(|E||fmax|) ◮ If c: E → R, algorithm may not terminate.

7 / 12

slide-8
SLIDE 8

Edmonds-Karp Algorithm

Edmonds-Karp Algorithm

◮ Start with f (e) = 0 for all edges e ∈ E. ◮ Find a shortest s, t-path P in Gf . ◮ Update f with maximum flow for P. ◮ Update Gf . ◮ Repeat.

Ford-Fulkerson

◮ Finds some s, t-path in Gf . ◮ Runtime: O(|E||fmax|) (integer capacities)

Edmonds-Karp Algorithm

◮ Finds a shortest s, t-path in Gf . ◮ Runtime: O(|V||E|2)

Best known result today: O(|V||E|) (complicated)

8 / 12

slide-9
SLIDE 9

Max-Flow Min-Cut Theorem

slide-10
SLIDE 10

Cut

s,t-Cut An s,t-cut (S, T) in a graph G = (V, E) is a partition of V into S and T such that s ∈ S and t ∈ T. The flow f (S, T) is defined as f (S, T) =

  • x∈S,y∈T,xy∈E

f (xy) −

  • x∈S,y∈T,yx∈E

f (yx). The capacity c(S, T) is defined as c(S, T) =

  • x∈S,y∈T,xy∈E

c(xy).

10 / 12

slide-11
SLIDE 11

Flows and Cuts

Lemma Maximum s,t-flow ≤ minimum s,t-cut, i. e., maxf |f | ≤ min(S,T) c(S, T).

  • Proof. Follows from definition.
  • Lemma

For each s,t-cut (S, T), f (S, T) = |f |. Proof.

◮ Let V = {s = v0, v1, v2, . . . , vn−1, vn = t} and Vi = {vi, vi+1, . . . , vn}. ◮ |f | =

  • sv∈E

f (s, v) and, for all v ∈ V \ {s, t},

  • uv∈E

f (uv) =

  • vw∈E

f (vw).

◮ Thus, f ({s}, V1) = f ({s, v1}, V2) = . . . = f (S, T).

  • 11 / 12
slide-12
SLIDE 12

Max-Flow Min-Cut Theorem

Theorem For any s,t-flow f , the following three conditions are equivalent. (i) f is a maximum s,t-flow in G. (ii) There is no augmenting s,t-path in Gf . (iii) There is an s,t-cut (S, T) in G with c(S, T) = |f |. (i) → (ii): If there would be an s,t-path P in Gf , |f | could be increased by the capacity of P. (ii) → (iii): There is no augmenting s,t-path in Gf . Let S be the set of vertices reachable from s in Gf and T = V \ S. If c(S, T) > f (S, T), there is an edge xy in Gf with x ∈ S and y ∈ T. Thus, y is reachable from s. Contradiction. (iii) → (i): There is an s,t-cut (S, T) in G with c(S, T) = |f |. Because maxf |f | ≤ min(S,T) c(S, T), f is a maximum s,t-flow in G.

  • 12 / 12