Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS138A 1999 1 Network Flows Peter Schröder. CS138A 1999 2 Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)

Similar presentations


Presentation on theme: "CS138A 1999 1 Network Flows Peter Schröder. CS138A 1999 2 Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)"— Presentation transcript:

1 CS138A 1999 1 Network Flows Peter Schröder

2 CS138A 1999 2 Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v) in E has a nonnegative capacity c(u,v) there are two distinguished vertices: a source s and a sink t for simplicity assume that every vertex lies on some path from s to t (this implies that the graph is connected)

3 CS138A 1999 3 Flow Definition a flow on a graph is a real valued function VxV>R with the following properties capacity constraint: for all u,v in V skew symmetry: for all u,v in V flow conservation: for all u in V\{s,t}

4 CS138A 1999 4 Flow Definitions the value of a flow is defined as in the maximum flow problem we wish to find the maximum flow from s to t in some graph G=(V,E) non zero net flow from u to v implies (u,v) in E or (v,u) in E

5 CS138A 1999 5 Flow Multiple sources and sinks introduce super source and super sink with infinite capacity connections to the individuals sources and sinks respectively implicit set summation convention Lemma 1: Let G=(V,E) be a flow network and let f be a flow in G. Then for X subset V

6 CS138A 1999 6 Example Use implicit set summation to prove by definition by Lemma 1 by flow conservation

7 CS138A 1999 7 Ford-Fulkerson Method Principles behind differing implementations repeated update through augmenting paths if there is unused capacity left, use it… 1. Ford-Fulkerson-Method(G,s,t) 2. initialize flow to 0 3. while( exists augmenting path ) 4. augment flow f along path 5. return f

8 CS138A 1999 8 Residual Networks Formalization of remaining flow opportunities given flow network G=(V,E) and flow f define residual capacity the residual flow network is induced by they positive residual capacity G f =(V,E f ) where E f consists of all pairs u,v in V with positive residual flow capacity (note that it can have as many as twice as many edges)

9 CS138A 1999 9 Properties Residual networks Lemma 2: Let G=(V,E) be a flow network with source s and sink t and f be a flow; let G f be the residual network induced and let f’ be a flow in G f then the flow sum f+f’ is a flow in G with value |f+f’|=|f|+|f’| Augmenting path simple path p in residual network from s to t residual capacity c f (p) is minimum capacity along path p

10 CS138A 1999 10 Residual Capacity Property Lemma 3: let G=(V,E) be a flow network with flow f and p be an augmenting path in G f. Define then f p is a flow in G f with value |f p |=c f (p) positive

11 CS138A 1999 11 Residual Capacity Adding an augmenting flow Corollary 4: Let G=(V,E) be a flow network with flow f and p be an augmenting path in G f Let f p be defined as before; define f’=f+f p then f’ is a flow in G with value |f’|=|f|+|f p | greater than |f| immediate from previous two lemmas

12 CS138A 1999 12 Cuts of Flow Networks What is a cut? a cut(S,T) is a partition of V into S and T with s in S and t in T with net flow f(S,T) and capacity c(S,T) (picture) Lemma 5: let f be a flow in a flow network G with source s and sink t and let (S,T) be a cut of G; then f(S,T)=|f| Corollary 6: the value of any flow f in a flow network G is bounded from above by the capacity of any cut of G

13 CS138A 1999 13 Cuts in Flow Networks Max-flow min-cut theorem Theorem 7: if f is a flow in a flow network G=(V,E) with source s and sink t, then the following conditions are equivalent: f is a maximum flow in G the residual network G f contains no augmenting paths |f|=c(S,T) for some cut (S,T) of G

14 CS138A 1999 14 Basic Ford-Fulkerson Iteratively increase flow by residual capacity 1. Ford-Fulkerson(G,s,t) 2. for( (u,v) in E[G] ) 3. f[u,v] = 0; f[v,u] = 0; 4. while( exists path p from s to t in G f ) 5. c f (p) = min{c f (u,v): (u,v) in p} 6. for( (u,v) in E[p] ) 7. f[u,v] = f[u,v]+c f (p); 8. f[v,u] = -f[u,v]

15 CS138A 1999 15 Ford-Fulkerson Running time: depends on method to pick augmenting path (use BFS) Edmonds-Karp algorithm pick p with BFS looking for the shortest path with unit edge lengths in the residual network; O(VE 2 ) Lemma 8: when Edmunds-Karp is run on G then for all vertices v in V\{s,t} the shortest path distance in the residual network G f increases monotonically with augmentation

16 CS138A 1999 16 Edmunds-Karp Properties Theorem 9: if the Edmonds-Karp algorithm is run on a flow network G=(V,E) with source s and sink t, then the total number of flow augmentations performed by the algorithm is at most O(VE)


Download ppt "CS138A 1999 1 Network Flows Peter Schröder. CS138A 1999 2 Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)"

Similar presentations


Ads by Google