# UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.

## Presentation on theme: "UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network."— Presentation transcript:

UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network Flows, Case Study

Chapter Dependencies Ch 1-6 Math Review: Asymptotics, Recurrences, Summations, Sets, Graphs, Counting, Probability, Calculus, Proofs Techniques (e.g. Inductive) Logarithms Ch 7-10 Sorting Ch 11-14, 15 Data Structures Ch 16, 17, 18 Advanced Design & Analysis Techniques Ch 19-22 Advanced Data Structures Ch 23-25,26,27 Graph Algorithms Ch 28, 29 Parallel Comparison-Based Sorting Networks, Arithmetic Circuits Ch 30 Parallel Comparison-Based Sorting Networks Ch 31 Matrix Operations Math: Linear Algebra Ch 35 Computational Geometry Math: Geometry (High School Level) Ch 36 NP-Completeness Ch 37 Approximation Algorithms

Network Flow Chapter 27

Basic Network Flow Concepts

Network Flow source: Sedgewick, Graph Algorithms weighted network edge weights Goal: compute second set of edge weights <= capacities. flow direction source sink flow in = flow out (except at source, sink)

Network Flow Applications ä Distribution Problems ä move objects from place to place within network ä examples: ä merchandise ä communications ä traffic flow source: Sedgewick, Graph Algorithms

Network Flow Applications (continued) ä Matching Problems ä network represents ways to connect vertices ä goal: choose connections to ä cover vertex set ä only touch each vertex once ä examples: ä job placement ä minimum-distance point matching (2 point sets) source: Sedgewick, Graph Algorithms

Network Flow Applications (continued) ä Cut Problems ä remove edges to cut network into >= 2 pieces ä examples: ä network reliability ä cutting supply lines source: Sedgewick, Graph Algorithms

Flow Definitions ä Flow network G = (V,E) ä directed graph ä each edge (u,v) in E has capacity c(u,v) >= 0 ä every vertex is on some path from source s to sink t ä G is connected ä |E| >= |V| - 1 source: 91.503 textbook Cormen et al.

Flow Properties ä Flow in G is f: VxV -> R satisfying: ä Capacity Constraint: ä Skew Symmetry: ä Flow Conservation: ä f(u,v) is net flow from vertex u to vertex v ä positive net flow entering vertex v: ä positive net flow entering a vertex other than source or sink must = positive net flow leaving the vertex ä Value of a flow f is total net flow out of source: source: 91.503 textbook Cormen et al.

Flow Properties (continued) ä Lemma 27.1 ä Let G=(V,E) be a flow network, and let f be a flow in G. Then: ä Implicit summation notation: source: 91.503 textbook Cormen et al. Exercise: show

source: Sedgewick, Graph Algorithms Flow Properties (continued) Flow Equilibrium A = amount of flow into left set from outside right set B = amount of flow out of left set (and not into right set) C = amount of flow into right set from outside left set D = amount of flow out of right set (and not into left set) y = amount of flow into left set from right set x = amount of flow into right set from left set EQUILIBRIUM requires A + x = B + y C + y = D + x A + C = B + D

Controlling Network Flow source: Sedgewick, Graph Algorithms open switches along path open switches along path change switch at 1 to redirect flow to fill 1-4; add flow on (maxflow results)

Augmenting Paths

Augmenting Flow on a Path source: Sedgewick, Graph Algorithms increase flow in 2 2 2 2 decrease flow in divert to, 1 1 1 1 2 flow increases from 3 to 4

Augmenting Path Sequences source: Sedgewick, Graph Algorithms

Residual Networks

source: 91.503 textbook Cormen et al. flow network G and flow f residual network G f and augmenting path augmented flow in G augmented flow in G f min capacity on augmenting path

Residual Networks source: Sedgewick, Graph Algorithms

Cuts

s-t Cut source: Sedgewick, Graph Algorithms Disconnects source from sink

MaxFlow MinCut Theorem ä If f is a flow in a flow network G=(V,E) with source s and sink t, then, equivalently: ä 1. f is a maximum flow in G ä 2. The residual network G f contains no augmenting paths ä 3. |f| = c(S,T) for some cut (S,T) of G source: 91.503 textbook Cormen et al.

MaxFlow MinCut Theorem Proof Layout Lemma 27.1 Lemma 27.2 Lemma 27.3 Corollary 27.4 Lemma 27.5 Corollary 27.6 Eq 27.6 Eq 27.4 MaxFlow MinCut (3) -> (1) (1) -> (2) (2) -> (3)

Ford-Fulkerson MaxFlow Method

General Approach source: 91.503 textbook Cormen et al.

With Residual Networks source: 91.503 textbook Cormen et al.

Analysis source: 91.503 textbook Cormen et al. Time depends on method termination?  (E) time  ( | max f | ) iterations, assuming integral capacities Each iteration of while loop can be executed in O(E) time = time to find path in residual network using BFS or DFS Each iteration of while loop can be executed in O(E) time = time to find path in residual network using BFS or DFS Total time =  ( E | max f | ) assuming integral capacities Total time =  ( E | max f | ) assuming integral capacities

Shortest Augmenting Paths Edmonds-Karp source: Sedgewick, Graph Algorithms

Shortest Augmenting Paths Edmonds-Karp ä Time is in O(VE 2 ): ä Each iteration of while loop takes time in O(E) ä Number of iterations is in O(VE) ä Shortest-path distance in residual network increases monotonically with each flow augmentation ä Total number of augmentations is in O(VE) ä Proof Sketch: ä Edge in residual network is critical on augmenting path if residual capacity of path is residual capacity of (u,v) ä Critical edge disappears from residual network ä Critical edge reappears only if net flow from u to v is decreased; happens only if (v,u) appears later on another augmenting path ä From time (u,v) becomes critical to time it next becomes critical, distance of u from source increases by >= 2 ä (u,v) becomes critical at most O(V) times

Graph Algorithms Research Case Study

Case Study Literature Wu, Li [1999]

ä Board work ä In-class exercise

Backup Slides

source: Sedgewick, Graph Algorithms

Download ppt "UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network."

Similar presentations