UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 5 Wednesday, 10/4/06 Graph Algorithms: Part 2.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
1 Review of some graph algorithms Graph G(V,E) (Chapter 22) –Directed, undirected –Representation Adjacency-list, adjacency-matrix Breadth-first search.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
The Maximum Network Flow Problem. CSE Network Flows.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 The Max Flow Problem. 2 Flow networks Flow networks are the problem instances of the max flow problem. A flow network is given by 1) a directed graph.
CS138A Network Flows Peter Schröder. CS138A Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lectures 3 Tuesday, 9/25/01 Graph Algorithms: Part 1 Shortest.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.
The max flow problem
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2008 Lecture 5 Tuesday, 10/7/08 Graph Algorithms: Part 2.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Assignment 4. (Due on Dec 2. 2:30 p.m.) This time, Prof. Yao and I can explain the questions, but we will NOT tell you how to solve the problems. Question.
Flow Networks Formalization Basic Results Ford-Fulkerson Edmunds-Karp Bipartite Matching Min-cut.
Maximum Flow Chapter 26.
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
Maximum Flow Algorithms —— ACM 黄宇翔. 目录 Max-flow min-cut theorem 12 Augmenting path algorithms 3 Push-relabel maximum flow algorithm.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
1 WEEK 11 Graphs III Network Flow Problems A Simple Maximum-Flow Algorithm Izmir University of Economics.
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
Algorithm Design and Analysis (ADA)
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Data Structures & Algorithms Network Flow Richard Newman based on book by R. Sedgewick.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
A directed graph G consists of a set V of vertices and a set E of arcs where each arc in E is associated with an ordered pair of vertices from V. V={0,
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
Instructor Neelima Gupta Edited by Divya Gaur(39, MCS '09) Thanks to: Bhavya(9), Deepika(10), Deepika Bisht(11) (MCS '09)
The Maximum Network Flow Problem
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Network Flow What is a network? Flow network and flows
Maximum Flow Chapter 26.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
CS4234 Optimiz(s)ation Algorithms
Instructor: Shengyu Zhang
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Flow Networks Topics Flow Networks Residual networks
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Lecture 5 Tuesday, 3/2/10 Graph Algorithms: Part 2
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Advanced Graph Homer Lee 2013/10/31.
Presentation transcript:

UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 5 Wednesday, 10/4/06 Graph Algorithms: Part 2

Network Flow Chapter 26

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 ProblemsDistribution Problems move objects from place to place within networkmove objects from place to place within network examples:examples: merchandisemerchandise communicationscommunications traffic flowtraffic flow source: Sedgewick, Graph Algorithms

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

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

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

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

Flow Properties (continued) Lemma 26.1 Lemma 26.1 Let G=(V, E) be a flow network, and let f be a flow in G. Then: Let G=(V, E) be a flow network, and let f be a flow in G. Then: Implicit summation notation: Implicit summation notation: source: 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 right set from left set x = amount of flow into left set from right 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) 2 leave s 2 flow into t 3 leave s 3 flow into t increase by 1 reduce by 1

Augmenting Paths

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

Augmenting Path Sequences source: Sedgewick, Graph Algorithms Try #1 Try #2 Try #3 Strategy: Keep trying until no augmenting path can be found. Same max flow in each case although strategy is greedy! To show strategy always produces max flow, 3 key ideas: 1) 1)augmenting paths 2) 2)residual networks 3) 3)cuts

Residual Networks

source: 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 capacity flow = amount we can remove (no 0 edges are shown)

Cuts

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

s-t Cut source: textbook Cormen et al. c(S,T)=29 c(S,T)=26 c(S,T)=24 “Negative” flow edges are excluded from cut capacity. Minimum cut is cut (S,T) whose capacity is minimum over all s-t cuts of network.

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

MaxFlow MinCut Theorem Proof Layout Lemma 26.1 Lemma 26.2 Lemma 26.3 Corollary 26.4 Lemma 26.5 Corollary 26.6 Eq 26.6 Eq 26.4 MaxFlow MinCut Theorem 26.7 (3) -> (1) (1) -> (2) (2) -> (3)

Ford-Fulkerson MaxFlow Method

General Approach source: textbook Cormen et al.

With Residual Networks source: textbook Cormen et al.

Analysis source: 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(|V||E| 2 ):Time is in O(|V||E| 2 ): Each iteration of while loop takes time in O(|E|)Each iteration of while loop takes time in O(|E|) Number of iterations is in O(|V||E|)Number of iterations is in O(|V||E|) Shortest-path distance in residual network increases monotonically with each flow augmentationShortest-path distance in residual network increases monotonically with each flow augmentation Total number of augmentations is in O(|V||E|)Total number of augmentations is in O(|V||E|) Proof Sketch:Proof Sketch: Edge in residual network is critical on augmenting path if residual capacity of path is residual capacity of (u,v)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 networkCritical 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 pathCritical 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 >= 2From 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(u,v) becomes critical at most O(|V|) times