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 

Slides:



Advertisements
Similar presentations
Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
Advertisements

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.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
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.
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.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
Feasible Flow Network : A digraph with a nonnegative capacity c(e) on each edge e and a distinguished source node s and sink node t. Flow: A flow f assign.
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 Flow CSC 172 SPRING 2002 LECTURE 27. Flow Networks Digraph Weights, called capacities, on edges Two distinct veticies Source, “s” (no incoming.
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.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
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. p2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
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.
Exercise 6.1 Find the number of different shortest paths from point A to point B in a city with perfectly horizontal streets and vertical avenues as shown.
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.
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.
CSE 421 Algorithms Richard Anderson Lecture 21 Shortest Paths and Network Flow.
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
Max-flow, Min-cut Network flow.
CS4234 Optimiz(s)ation Algorithms
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
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.
Max-flow, Min-cut Network flow.
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
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 and Connectivity in Wireless Sensor Networks
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
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
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

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 

Fall 2003Maximum Flow2 Outline and Reading Flow networks Flow (§8.1.1) Cut (§8.1.2) Maximum flow Augmenting path (§8.2.1) Maximum flow and minimum cut (§8.2.1) Ford-Fulkerson’s algorithm (§ )

Fall 2003Maximum Flow3 Flow Network A flow network (or just network) N consists of A weighted digraph G with nonnegative integer edge weights, where the weight of an edge e is called the capacity c(e) of e Two distinguished vertices, s and t of G, called the source and sink, respectively, such that s has no incoming edges and t has no outgoing edges. Example: w s v u t z

Fall 2003Maximum Flow4 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 edge e, 0  f (e)  c(e) Conservation Rule: For each vertex v  s,t where E  (v) and E  (v) are the incoming and outgoing edges of v, resp. The value of a flow f, denoted |f|, is the total flow from the source, which is the same as the total flow into the sink Example: w s v u t z 3/33/3 2/92/9 1/11/1 1/31/3 3/73/7 2/62/6 4/54/5 1/11/1 3/53/5 2/22/2

Fall 2003Maximum Flow5 A flow for a network N is said to be maximum if its value is the largest of all flows for N The maximum flow problem consists of finding a maximum flow for a given network N Applications Hydraulic systems Electrical circuits Traffic movements Freight transportation w s v u t z 3/33/3 2/92/9 1/11/1 1/31/3 3/73/7 2/62/6 4/54/5 1/11/1 3/53/5 2/22/2 w s v u t z 3/33/3 2/92/9 1/11/1 3/33/3 3/73/7 4/64/6 4/54/5 1/11/1 3/53/5 2/22/2 Flow of value 8 = = Maximum flow of value 10 = =

Fall 2003Maximum Flow6 Cut A cut of a network N with source s and sink t is a partition   (V s,V t ) of the vertices of N such that s  V s and t  V t Forward edge of cut  : origin in V s and destination in V t Backward edge of cut  : origin in V t and destination in V s Flow f(  ) across a cut  : total flow of forward edges minus total flow of backward edges Capacity c(  ) of a cut  : total capacity of forward edges Example: c(  )  24 f(  )  8 w s v u t z  w s v u t z 3/33/3 2/92/9 1/11/1 1/31/3 3/73/7 2/62/6 4/54/5 1/11/1 3/53/5 2/22/2 

Fall 2003Maximum Flow7 Flow and Cut Lemma: The flow f(  ) across any cut  is equal to the flow value |f| Lemma: The flow f(  ) across a cut  is less than or equal to the capacity c(  ) of the cut Theorem: The value of any flow is less than or equal to the capacity of any cut, i.e., for any flow f and any cut , we have |f|  c(  ) w s v u t z 3/33/3 2/92/9 1/11/1 1/31/3 3/73/7 2/62/6 4/54/5 1/11/1 3/53/5 2/22/2 11 22 c(  1 )  12  6  3  1  2 c(  2 )  21  3  7  9  2 |f|  8

Fall 2003Maximum Flow8 Augmenting Path Consider a flow f for a network N Let e be an edge from u to v : Residual capacity of e from u to v :  f (u, v) = c(e)  f (e) Residual capacity of e from v to u :  f (v, u) = f (e) Let  be a path from s to t The residual capacity  f (  ) of  is the smallest of the residual capacities of the edges of  in the direction from s to t A path  from s to t is an augmenting path if  f (  )  0 w s v u t z 3/33/3 2/92/9 1/11/1 1/31/3 2/72/7 2/62/6 4/54/5 0/10/1 2/52/5 2/22/2   f (s,u)  3  f (u,w)  1  f (w,v)  1  f (v,t)  2  f (  )  1 |f|  7

Fall 2003Maximum Flow9 Flow Augmentation Lemma: Let  be an augmenting path for flow f in network N. There exists a flow f for N of value | f | = |f |   f (  ) Proof: We compute flow f by modifying the flow on the edges of  Forward edge: f (e) = f(e)  f (  ) Backward edge: f (e) = f(e)  f (  ) w s v u t z 3/33/3 2/92/9 1/11/1 1/31/3 2/72/7 2/62/6 4/54/5 0/10/1 2/52/5 2/22/2   f (  ) = 1 w s v u t z 3/33/3 2/92/9 0/10/1 2/32/3 2/72/7 2/62/6 4/54/5 1/11/1 3/53/5 2/22/2  | f | = 7 | f | = 8

Fall 2003Maximum Flow10 Ford-Fulkerson’s Algorithm Initially, f(e)  0 for each edge e Repeatedly Search for an augmenting path  Augment by  f (  ) the flow along the edges of  A specialization of DFS (or BFS) searches for an augmenting path An edge e is traversed from u to v provided  f (u, v)  0 Algorithm FordFulkersonMaxFlow(N) for all e  G.edges() setFlow(e, 0) while G has an augmenting path  { compute residual capacity  of  }    for all edges e  { compute residual capacity  of e } if e is a forward edge of    getCapacity(e)  getFlow(e) else { e is a backward edge }   getFlow(e) if  <    { augment flow along  } for all edges e  if e is a forward edge of  setFlow(e, getFlow(e)  ) else { e is a backward edge } setFlow(e, getFlow(e)  )

Fall 2003Maximum Flow11 Max-Flow and Min-Cut Termination of Ford-Fulkerson’s algorithm There is no augmenting path from s to t with respect to the current flow f Define V s set of vertices reachable from s by augmenting paths V t set of remaining vertices Cut   (V s,V t ) has capacity c(  ) = |f| Forward edge: f(e) = c(e) Backward edge: f(e) = 0 Thus, flow f has maximum value and cut  has minimum capacity 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  Theorem: The value of a maximum flow is equal to the capacity of a minimum cut c(  )  | f |  10

Fall 2003Maximum Flow12 Example (1) w s v u t z 0/30/3 0/90/9 0/10/1 0/30/3 1/71/7 0/60/6 0/50/5 1/11/1 1/51/5 0/20/2 w s v u t z 1/31/3 0/90/9 0/10/1 0/30/3 1/71/7 0/60/6 1/51/5 0/10/1 1/51/5 1/21/2 w s v u t z 1/31/3 0/90/9 1/11/1 0/30/3 2/72/7 1/61/6 1/51/5 0/10/1 1/51/5 1/21/2 w s v u t z 2/32/3 0/90/9 0/10/1 1/31/3 2/72/7 1/61/6 1/51/5 0/10/1 1/51/5 1/21/2

Fall 2003Maximum Flow13 Example (2) w s v u t z 2/32/3 0/90/9 0/10/1 3/33/3 2/72/7 3/63/6 1/51/5 0/10/1 1/51/5 1/21/2 w s v u t z 3/33/3 1/91/9 0/10/1 3/33/3 2/72/7 3/63/6 2/52/5 0/10/1 1/51/5 1/21/2 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 3/73/7 4/64/6 2/52/5 0/10/1 1/51/5 1/21/2 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 two steps

Fall 2003Maximum Flow14 Analysis In the worst case, Ford- Fulkerson’s algorithm performs |f*| flow augmentations, where f* is a maximum flow Example The augmenting paths found alternate between  1 and  2 The algorithm performs 100 augmentations Finding an augmenting path and augmenting the flow takes O(n  m) time The running time of Ford- Fulkerson’s algorithm is O(|f*|(n  m)) t s v u 1/11/1 1/50 0/50 1/50 0/50 t s v u 0/10/1 1/50 11 22