DS-chapter9(graph -2)

DS-chapter9(graph -2) - 9.4 Network Flow Problems . Example...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
9.4 Network Flow Problems . Example . Consider the following network of pipes: s d c b a t 3 3 3 2 2 2 1 4 source sink Note: Total coming in ( v ) Total going out ( v ) where v { s , t } Determine the maximum amount of flow that can pass from s to t .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Network Flow Problems 1. A Simple Algorithm s d c b a t 3 3 3 2 2 2 1 4 G s d c b a t Flow G f s d c b a t Residual G r Step 1: Find any path s t in G r ; augmenting path Step 2: Take the minimum edge on this path as the amount of flow and add to G f ; Step 3: Update G r and remove the 0 flow edges; Step 4: If (there is a path s t in G r ) Goto Step 1 ; Else End.
Background image of page 2
Network Flow Problems s d c b a t 3 3 3 2 2 2 1 4 G It is simple indeed. But I bet that you will point out some problems here… You are right! What if I pick up the path s a d t first? Uh-oh… Seems we cannot be greedy at this point.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Network Flow Problems 2. A Solution – allow the algorithm to undo its decisions For each edge ( v , w ) with flow f v , w in G f , add an edge ( w , v ) with flow f v , w in G r . s d c b a t Flow G f s d c b a t 3 3 3 2 2 2 1 4 G s d c b a t Residual G r 3 1 4 3 3 3 3 1 2 2 2 2 2 2 1 3 2 2 1 . Proposition . If the edge capabilities are rational numbers , this algorithm always terminate with a maximum flow. Note: The algorithm works for G with cycles as well.
Background image of page 4
Network Flow Problems 3. Analysis ( If the capacities are all integers ) An augmenting path can be found by an unweighted shortest path algorithm. T = O( ) where f is the maximum flow. f · | E | s t a b 1 000 000 1 000 000 1 000 000 1 000 000 1 Always choose the augmenting path that allows the largest increase in flow.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/16/2011 for the course CS 135 taught by Professor Yuechen during the Fall '08 term at Zhejiang University.

Page1 / 15

DS-chapter9(graph -2) - 9.4 Network Flow Problems . Example...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online