CSE%20202%20-%20Algorithms - PowerPoint PPT Presentation

About This Presentation
Title:

CSE%20202%20-%20Algorithms

Description:

Title: Title Author: carter Last modified by: carter Created Date: 5/29/2001 8:54:35 PM Document presentation format: Overhead Company: UCSD Other titles – PowerPoint PPT presentation

Number of Views:113
Avg rating:3.0/5.0
Slides: 13
Provided by: cart62
Learn more at: https://cseweb.ucsd.edu
Category:

less

Transcript and Presenter's Notes

Title: CSE%20202%20-%20Algorithms


1
CSE 202 - Algorithms
  • Max Flow Problems

2
Max Flow problem
  • Input a directed graph with a non-negative
    weight (capacity) on each edge, and a designated
    source node s and sink node t.
  • A flow assigns to each edge a number (from 0 to
    its capacity) such that for each node except s
    and t, the sum of the flow into the node equals
    sum of the flow out. The fine print this is
    slightly different from the books definition.
  • The value of a flow is the sum of the flow out of
    the source (which equals total flow into the
    sink).
  • Maximum-Flow problem find a flow with the
    maximum possible value.
  • Note A max flow can assign 0 to each edge going
    into the source, and to each edge going out of
    the sink.

3
Example
12
a
c
20
16
t
9
4
s
10
7
sink
4
d
13
source
b
14
12
a
c
14
10
0
t
4
s
2
2
4
d
8
This is wasteful! The texts formulation doesnt
even let it happen.
b
6
A flow of value 18
4
Leftover capacity
12-12
a
c
20-14
16-10
9-0
t
s
4-4
10-2
7-2
sink
4-4
d
13-8
source
b
14-6
0
New backedge showing we can reduce forward flow
by 10
a
c
6
6
12
14
10
9
t
2
s
8
5
2
4
8
6
0
d
5
b
8
Residual network
5
Augmenting Path
0
We can push 5 more through network on indicated
path (New flow has value 23.)
a
c
6
6
12
14
10
9
t
2
s
8
5
2
4
8
6
0
d
5
b
8
0
a
c
6
1
12
19
10
9
t
2
s
8
0
7
4
13
11
0
d
0
Now were stuck! We cant get any more across cut.
b
3
New residual network
6
Duality Max Flow Min Cut
  • Original problem had a cut of value 23. We cant
    possibly get more from source to sink.
  • Theorem Max flow min cut
  • Proof Obviously, any flow ? min cut.
  • But if max flow lt min cut, there would be an
    augmenting path from source to sink, leading to a
    higher-valued flow.
  • This is a contradiction. Thus, max flow min
    cut. QED.

12
a
c
20
16
t
9
4
s
10
7
4
d
13
b
14
7
Ford-Fulkerson Methods
  • initialize flow to 0
  • while (theres an augmenting path)
  • update flow
  • compute new residual graph
  • If there are several augmenting paths, does it
    matter which we pick??

a
100
100
t
1
s
1
100
100
b
8
Edmonds-Karp Algorithm
  • Always choose an augmenting path with as few
    edges as possible (say it has L edges).
  • This might create a new backedge, e.g (v,u).
  • This new edge cant be in a new path of L edges..
  • (Handle multiple new backedges by induction
    proof.)
  • Meanwhile, at least one original edge has been
    eliminated.
  • Thus, there are at most E iterations using L
    long paths.

k long path
v
m long
v
t
t
s
s
n long
u
u
j long path
m ? j1 and n ? k1 so mn gt jk1 L
j1k is a minimal length path (L)
9
Edmonds-Karp Algorithm
  • Always choose an augmenting path with as few
    edges as possible.
  • At most E iterations use L-edge augmenting path
  • Longest augmenting path has V-1 edges.
  • Thus, there are at most O(VE) augmentations.
  • How long does it take to find and process a
    shortest augmenting path??

10
Max Flow Algorithms
  • Edmonds-Karp is O(VE2)
  • Some faster algorithms based on Push-Relabel.
  • E.g. Goldbergs algorithm is O(V2E)
  • Start source at height V, all others at 0
  • Add in flow from higher nodes to lower ones.
  • If a non-sink node cant push all its incoming
    flow out, increase its height.
  • When done, return excess back to source.
  • Carefully choosing order gives O(V3) algorithm.
  • Fastest known algorithm is
  • O( min(V2/3, E1/2) E lg(1V2/E) lg(max capacity)
    ).

11
An Application
  • Maximum matching problem
  • Given an (undirected) graph (V,E) find a
    maximum-sized set of disjoint edges.
  • Not the same as a maximal set of disjoint edges.
  • Amazingly, not NP-complete (but its not easy)
  • Bipartite graph Graph such that you can
    partition the nodes V V1 U V2, and every edge
    goes between a node of V1 and one of V2.
  • Maximum matching for a bipartite graph can be
    reduced to a max flow problem.

12
Glossary (in case symbols are weird)
  • ???????????????? ? ? ? ? ? ? ? ? ?
  • ? subset ? element of ? infinity ? empty
    set
  • ? for all ? there exists ? intersection ?
    union
  • ? big theta ? big omega ? summation
  • ? gt ? lt ? about equal
  • ? not equal ? natural numbers(N)
  • ? reals(R) ? rationals(Q) ? integers(Z)
Write a Comment
User Comments (0)
About PowerShow.com