CSCI 256 Data Structures and Algorithm Analysis Lecture 18 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.

Slides:



Advertisements
Similar presentations
COMP 482: Design and Analysis of Algorithms
Advertisements

Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
Network Optimization Models: Maximum Flow Problems
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Lectures on Network Flows
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Advanced Algorithms Piyush Kumar (Lecture 2: Max Flows) Welcome to COT5405 Slides based on Kevin Wayne’s slides.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
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.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Advanced Algorithms Piyush Kumar (Lecture 5: Weighted Matching) Welcome to COT5405 Based on Kevin Wayne’s slides.
Advanced Algorithms Piyush Kumar (Lecture 5: Weighted Matching) Welcome to COT5405 Based on Kevin Wayne’s slides.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
10. Lecture WS 2006/07Bioinformatics III1 V10: Network Flows V10 follows closely chapter 12.1 in on „Flows and Cuts in Networks and Chapter 12.2 on “Solving.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
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.
CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 23.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Markov Random Fields in Vision
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Flow A flow f for a network N is is an assignment of an integer value f(e) to each edge e that satisfies the following properties: Capacity Rule: For each.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
CS4234 Optimiz(s)ation Algorithms
Lectures on Network Flows
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
COMP 382: Reasoning about Algorithms
Instructor: Shengyu Zhang
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
CSE Algorithms Max Flow Problems 11/21/02 CSE Max Flow.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Network Flow and Connectivity in Wireless Sensor Networks
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
EE5900 Advanced Embedded System For Smart Infrastructure
Max Flow / Min Cut.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Network Flow.
Lecture 21 Network Flow, Part 1
MAXIMUM flow by Eric Wengert.
Introduction to Maximum Flows
Maximum Flow Neil Tang 4/8/2008
Introduction to Maximum Flows
Network Flow.
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

CSCI 256 Data Structures and Algorithm Analysis Lecture 18 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some by Iker Gondra

Network Flow Soviet Rail Network, 1955 Reference: On the history of the transportation and maximum flow problems. Alexander Schrijver in Math Programming, 91: 3, 2002.

Maximum Flow and Minimum Cut Max flow and min cut –Two very rich algorithmic problems –Cornerstone problems in combinatorial optimization –Beautiful mathematical duality Nontrivial applications / reductions –Data mining –Project selection –Airline scheduling –Bipartite matching –Baseball elimination –Image segmentation –Network connectivity –Network reliability –Distributed computing –Security of statistical data –Network intrusion detection –Multi-camera scene reconstruction –Many many more...

Flow Network Flow network –Abstraction for material flowing through the edges –G = (V, E) = directed graph, no parallel edges –Two distinguished nodes: s = source, t = sink –c(e) = capacity of edge e s t capacity source sink

Flows Def: An s-t flow is a function that satisfies –For each e  E: (capacity) –For each v  V – {s, t}: (conservation) Def: The value of a flow f is: The maximum-flow problem –Given a flow network, a natural goal is to arrange the traffic so as to make as efficient use as possible of the available capacity –Thus basic algorithmic problem is: given a flow network, find a flow of maximum possible value

Flow Example a s d b cf e g h i t

How to solve the Max-Flow Problem?? There is no known algorithm for the Maximum- Flow problem that can be viewed as belonging to the DP paradigm What about greedy approaches?? Let us look at a simple example

Simple Flow Example u st v

Towards a Max Flow Algorithm Greedy algorithm –Start with f(e) = 0 for all edges e  E –Find an s-t path P where each edge has f(e) < c(e) –Augment flow along path P –Repeat until you get stuck s 1 2 t Flow value = 0

Towards a Max Flow Algorithm Greedy algorithm –Start with f(e) = 0 for all edge e  E –Find an s-t path P where each edge has f(e) < c(e) –Augment flow along path P –Repeat until you get stuck s 1 2 t 20 Flow value = X X X 20

Towards a Max Flow Algorithm Greedy algorithm –Start with f(e) = 0 for all edge e  E –Find an s-t path P where each edge has f(e) < c(e) –Augment flow along path P –Repeat until you get stuck local optimality  global optimality greedy = 20 s 1 2 t opt = 30 s 1 2 t

Towards a Max Flow Algorithm The way we are going to increase the flow is by finding augmenting paths (i.e., s-t paths that increase the flow) The other way that we can increase the flow is by reversing the direction of flow Push forward on edges with leftover capacity and push backward on edges that are already carrying flow to divert it in a different direction To search for forward-backward capacity for a flow network G and a flow f on G define the notion of residual graph G f

Residual Graph G f has original nodes of G = (V,E), and but we redefine the set of edges and their capacities Original edge: e = (u, v)  E Given: flow f(e), capacity c(e) G f - Forward edge –(u,v)  E, where c(e) > f(e) G f - Backward edge –"Undo" flowsent – e R = (v, u) if f(e) > 0 - G f - Capacity: –For e: it is c(e)-f(e) –For e R : it is f(e) Residual graph: G f = (V, E f ) –E f = {e : f(e) 0} uv 17 6 capacity flow uv 11 residual capacity 6

Residual Graph –Any edge e such that f(e) 0) is called a backward edge – Consider our example graph with path s,1,2,t, and flows e(s,1) = 20, e(1,2) = 20 and e(2,t) = 20 and the other edges have 0 flow.

Below, the flow function f is indicated by blue. Build Residual Graph G f - do in class (see text fig 7.4 (b) ) s 1 2 t

To push flow from s to t in G f Call capacities in G f “residual capacities” Let P be a simple s-t path in G f Bottleneck (P,f) = the minimal residual capacity of any edge in P, with respect to f; denote it by b b units of flow can be added (to each edge) along the path P The following operation augment(f,P) yields a new flow f’ in G:

Augmenting Paths in a Residual Graph augment(f,P) Let b = bottleneck(P,f) For each edge (u,v) in P If e=(u,v) is a forward edge then increase f(e) in G by b Else (u,v) is a backward edge; let e = (v,u) decrease f(e) in G by b EndIf EndFor Return(f)

example The algorithm augment(f,P) results in a new flow f’ in G, obtained by increasing and decreasing the flow on edge values of P Start with f(e) = 0 everywhere. Then G f = G. Consider first (simple) path P: s,1, t. Let f’=augment (P,f); and find G f’ Then in our example with a new path simple P, the path s,2,1,t in G f’, find f’’= augment(f’,P) and find G f’’

Max-Flow Ford Fulkerson Algorithm Initially f(e) = 0 for all e in G While there is an s-t path in G f Find P a simple s-t path in G f f’=augment(P,f) Update the residual graph G f to be G f’ Let f’ be f and G f’ be G f EndWhile Return f