Introduction to Algorithms - PowerPoint PPT Presentation

Loading...

PPT – Introduction to Algorithms PowerPoint presentation | free to download - id: 74e112-OTAyZ



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Introduction to Algorithms

Description:

Introduction to Algorithms Maximum Flow My T. Thai _at_ UF – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 32
Provided by: MYTRATHAI
Learn more at: http://www.cise.ufl.edu
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Introduction to Algorithms


1
Introduction to Algorithms
  • Maximum Flow
  • My T. Thai _at_ UF

2
Flow networks
  • A flow network G (V, E) is a directed graph
  • Each edge (u, v) ? E has a nonnegative capacity
  • If (u, v) ? E , then
  • If ,
  • A source s and a sink t

3
Flow networks
  • A flow in G is a real-valued function
    that satisfies the two properties
  • Capacity constraint
  • ?u, v?V 0 ? f(u, v) ? c(u, v)
  • Flow conservation
  • ?u?V ? s, t ?v ?V f(u, v) ?v ?V f(v, u)
  • The value f of a flow f

(the total flow out of the source minus the flow
into the source)
Label of each edge f/c
4
Max-Flow Problem
  • Input A flow network G (V, E), s, and t
  • Output Find a flow of maximum value
  • Applications
  • Flow of liquid through pipes
  • Information through communication networks
  • Flow in a transport network

5
Remove antiparallel edges
(v1, v2) and (v2, v1) are antiparallel edges
Vertex v is added to remove edge (v1, v2)
6
Multiple sources and sinks
Add supersource s
Add supersink t
7
Ford-Fulkerson Method
8
Example
Augmenting path sv2v3t
All flows in the augmenting path are increased by
4 units
9
Residual network
  • Given flow f, the residual capacity of edge (u,
    v)
  • Residual network induced by f is Gf (V, Ef)

?
10
Flow augmentation
  • f is a flow in G and f is a flow in Gf , the
    augmentation of flow f by f( ), is a
    function from , defined by

11
Augmenting path
  • Any simple path p from s to t in G f is an
    augmenting path in G with respect to f
  • Flows on edges of p can be increased by the
    residual capacity of p

Cf(p) 4 with p is the shaded path
12
Increase the value of flow along augmenting paths
13
Cuts
  • A cut (S,T) of a flow network G (V, E) is a
    partition of V into S and T V ? S such that s ?
    S and t ? T.
  • The net flow across the cut
  • The capacity of the cut
  • A minimum cut of G is a cut
  • whose capacity is minimum
  • over all cuts of G

14
  • Proof
  • Flow conservation gt
    ,

gt
(regroup the formula)
(partition V to S and T)
15
Upper bound of flow value
  • Proof
  • Let (S, T) be any cut, f be any flow

16
Max-flow min-cut theorem
  • Proof
  • (1) gt (2) If Gf has an augmenting path p, then
    by Corollary 26.3, there exists a flow of value
    f Cf(p) gt f that is a flow in G
  • (2) gt (3) Suppose (2) holds. Define S v?V
    ? path from s to v in Gf, and T V S. (S, T)
    is a cut. For u ? S, v ? T, f(u,v) c(u,v)
  • By Lemma 26.4, f f(S,T) c(S,T)
  • (3) gt (1) By Corollary 26.5, f c(S,T)
    implies f is a maximum flow

17
Ford-Fulkerson algorithm
  • Running time
  • If capacities are integers, then O(Ef), where
    f is the maximum flow
  • With irrational capacities, might never
    terminate.

18
Example
19
(No Transcript)
20
No augmenting path
21
Bad example
  • FORD-FULKERSON runs 1000,000 iterations

22
Edmonds-Karp algorithm
  • Do FORD-FULKERSON, but compute augmenting paths
    by BFS of Gf . Augmenting paths are shortest
    paths from s to t in Gf , with all edge weights
    1
  • Running time O(VE2)
  • There are O(VE) flow augmentations
  • Time for each augmentation (BFS) is O(E)

23
Analysis of E-K
  • Proof (by contradiction)
  • Suppose that there exist 2 continuous flows f and
    f such that ?f?(s,v) ? ?f(s,v) for some v ? V
  • W.l.o.g suppose v is the nearest vertex (to s)
    satisfying ?f?(s,v) lt ?f(s,v) ()

24
Proof of Lemma 26.7
  • Let u be the vertex before v on the shortest path
    from s to v
  • gt
  • gt u is not the nearest vertex to s satisfying
    ()
  • gt
  • Claim . If not we have

(Contradicted)
25
  • gt The augmentation must increase flow v to u
  • Edmonds-Karp augments along shortest paths, the
    shortest path s to u in Gf has v ? u as its last
    edge

(Contradicted)
26
Time bound
  • Proof
  • Suppose p is augmenting path, (u, v) ? p, and
    cf(p) cf(u,v). Then (u, v) is critical, and
    disappears from the residual network after
    augmentation.
  • Before (u, v) becomes a critical edge again,
    there must be a flow back from v to u

27
Time bound
  • Claim each of the E edges can become critical
    V /2 - 1 times
  • Consider edge (u, v), when (u, v) becomes
    critical first time, df(s, v) df(s, u) 1
  • (u, v) reappears in the residual network after
    (v, u) is on an augmenting path in Gf , df(s,
    u) df(s, v) 1
  • gt

gtThe claim is proved gt The theorem is proved
28
Maximum bipartite matching
  • A matching is a subset of edges M ? E such that
    for all v ? V, 1 edge of M is incident on v.
  • Problem Given a bipartite graph find a matching
    of maximum cardinality.

each edge has capacity 1
(A maximum matching)
(Reduce to the maximum flow problem)
29
Integrality theorem
30
Summary
  • Max-flow min-cut theorem the capacity of the
    minimum cut equals to the value of the maximum
    flow
  • Ford-Fulkerson method iteratively find an
    augmenting path and augment flow along the path
  • Ford-Fulkerson algorithm find an arbitrary
    augmenting path in each iteration
  • If capacities are integers, then O(Ef), where
    f is the maximum flow
  • With irrational capacities, might never terminate.

31
Summary
  • Edmonds-Karp algorithm find a shortest
    augmenting path in each iteration
  • Time O(VE2)
  • Integrality theorem if all capacities are
    integral values, then the value of the maximum
    flow as well as flows on edges are integers
About PowerShow.com