Preflow Push Algorithm M. Amber Hassaan. Preflow Push Algorithm2 Max Flow Problem Given a graph with “Source” and “Sink” nodes we want to compute:  The.

Slides:



Advertisements
Similar presentations
Bo Hong Electrical and Computer Engineering Department Drexel University
Advertisements

Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
1 Review of some graph algorithms Graph G(V,E) (Chapter 22) –Directed, undirected –Representation Adjacency-list, adjacency-matrix Breadth-first search.
S Maximum Flow by Incremental Breadth First Search Sagi Hed Tel Aviv University Haim Kaplan Tel Aviv University Renato F. Werneck Microsoft Research Andrew.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
Network Optimization Models: Maximum Flow Problems
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Maximum Flow Computation Programming Puzzles and Competitions CIS 4900 / 5920 Spring 2009.
CSCI 256 Data Structures and Algorithm Analysis Lecture 18 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
The Maximum Network Flow Problem. CSE Network Flows.
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)
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
Outline Max Flow Algorithm Model of Computation Proposed Algorithm Self Stabilization Contribution 1 A self-stabilizing algorithm for the maximum flow.
1 Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
Lecture 8. Why do we need residual networks? Residual networks allow one to reverse flows if necessary. If we have taken a bad path then residual networks.
3/3/ Alperovich Alexander. Motivation  Find a maximal flow over a directed graph  Source and sink vertices are given 3/3/
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
Maximum Flow Maximum Flow Problem The Ford-Fulkerson method
Maximum Flow Chapter 26.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
Maximum Flow Algorithms —— ACM 黄宇翔. 目录 Max-flow min-cut theorem 12 Augmenting path algorithms 3 Push-relabel maximum flow algorithm.
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
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.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
Outline Standard 2-way minimum graph cut problem. Applications to problems in computer vision Classical algorithms from the theory literature A new algorithm.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 23.
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 
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)
Maximum Flow Chapter 26.
The Maximum Network Flow Problem
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.
Maximum Flow Chapter 26.
Graph Algorithms Minimum Spanning Tree (Chap 23)
Algorithms and Networks Hans Bodlaender
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Max-flow, Min-cut Network flow.
Algorithms and Networks
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
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Introduction to Maximum Flows
Flow Networks Topics Flow Networks Residual networks
Richard Anderson Lecture 21 Network Flow
Flow Networks General Characteristics Applications
Flow Networks and Bipartite Matching
Primal-Dual Algorithm
Algorithms (2IL15) – Lecture 7
Network Flow CSE 373 Data Structures.
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
Min Global Cut Animation
Lecture 21 Network Flow, Part 1
Dinitz's algorithm for finding a maximum flow in a network.
MAXIMUM flow by Eric Wengert.
and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the.
and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the.
7. Preflow-Push Demo.
Maximum Flow Neil Tang 4/8/2008
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

Preflow Push Algorithm M. Amber Hassaan

Preflow Push Algorithm2 Max Flow Problem Given a graph with “Source” and “Sink” nodes we want to compute:  The maximum rate at which fluid can flow from Source to Sink  The rate of flow through each edge of the graph Given a graph:  Edges have flow capacities First value is flow capacity Second value is current flow rate  Edges behave like pipes  Nodes are junctions of pipes History:  Ford and Fulkerson 1956 (Augmenting Paths)  Dinic 1970  Edmonds and Karp 1972  Malhotra, Kumar and Maheshwari 1978  Goldberg and Tarjan 1986 (Preflow Push)  Boykov and Kolmogorov 2006 s a b t 5, 2 8, 7 4, 4 6, 2 5, 5 Min-cut

Preflow Push Algorithm3 Max Flow Problem Flow f(u,v) is a real-valued function defined for every edge (u,v) in the graph The flow needs to satisfy the following 3 properties:  f(u,v) ≤ c(u,v) i.e. capacity of edge (u,v)  f(u,v) = - f(v,u)  Flow coming into node v = Flow leaving v s a b t 5, 2 8, 7 4, 4 6, 2 5, 5

Preflow Push Algorithm4 Max Flow Problem Residual Graph:  A Graph that contains edges that can admit more flow  Define a Graph G(V,E’) for G(V,E)  We define residual flow r(u,v) = c(u,v) – f(u,v)  If r(u,v) > 0 then (u,v) is in E’ s a b t 5, 2 8, 7 4, 4 6, 2 5, 5 s a b t Original GraphResidual Graph

Preflow Push Algorithm5 Preflow Push Algorithm for Maxflow problem Relaxation algorithm:  Performs local updates repeatedly until global constraint is satisfied  Similar to Stencil computations Fluid flows from a higher point to a lower point In the beginning  “Source” is the highest point  “Sink” and all other nodes are at the lowest point Source sends maximum flow on its outgoing edges  Sending flow to out-neighbors is called “Push” operation The height of Source’s neighbors is then increased so that fluid can flow out  Increasing height of a node is called “Relabel” operation

Preflow Push Algorithm6 Preflow Push Algorithm for Maxflow problem A node is allowed (temporarily) to have more flow coming into it than flow going out  i.e. a node can have “excess flow”  But the edges must respect the capacity condition  Source can have arbitrary amount of excess flow A node is said to be “active” if it has excess flow in it

Preflow Push Algorithm7 Preflow Push Algorithm for Maxflow problem We increase the height of the “active” node with a “Relabel” operation  If h is the minimum height among neighbors that can accept flow  Then height is relabeled to (h+1) Then we “push” the excess flow to the neighbors  That are lower than the active node and can admit flow  Thus make them active Algorithm terminates when there are no “active” nodes left

Preflow Push Algorithm8 Example A simple graph:  Nodes have two attributes: Height ‘h’ Excess flow ‘e’  Edges have pairs: First value is edge capacity Second value is flow Initialize:  s has h=6 i.e. number of nodes  Push 10 along (s,a) e(a) = 10  Push 12 along (s,c) e(c) = 12 s c ab t d h=6 h=0 e=0 h=0 e=0 h=0 e=0 h=0 e=0 h=0 e=0 10,0 12,0 5,0 8,0 15,0 6,0 17,0 3,0

Preflow Push Algorithm9 Example Relabel c with h=1  Push 6 along (c,d) e(d) = 6 Relabel c with h=2  Push 5 along (c,a) e(a) = 5 Relabel c with h=7  Push -1 along (s,c) s c ab t d h=6 h=0 e=10 h=0 e=10 h=0 e=0 h=1 e=12 h=0 e=0 10,10 12,12 5,0 8,0 15,0 6,0 17,0 3,0

Preflow Push Algorithm10 Example Relabel a with h=1  Push 15 along (a,b) e(b) = 15 s c ab t d h=6 h=1 e=15 h=0 e=0 h=0 e=0 h=7 e=0 h=0 e=5 10,10 12,11 5,5 8,0 15,0 6,6 17,0 3,0

Preflow Push Algorithm11 Example Relabel b with h=1  Push 3 along (b,t) e(t) = 3  Push 8 along (b,d) e(d) = 14 Relabel b with h=2  Push -4 along (a,b) e(a) = 4 s c ab t d h=6 h=1 e=0 h=1 e=15 h=0 e=3 h=7 e=0 h=0 e=6 10,10 12,11 5,5 8,0 15,15 6,6 17,0 3,0

Preflow Push Algorithm12 Example Relabel d with h=1  Push 14 along (d,t) e(t) = 17 s c ab t d h=6 h=1 e=4 h=2 e=0 h=0 e=3 h=7 e=0 h=1 e=14 10,10 12,11 5,5 8,8 15,11 6,6 17,0 3,3

Preflow Push Algorithm13 Example Relabel a with h=3  Push 4 along (a,b) e(b) = 4 s c ab t d h=6 h=3 e=4 h=2 e=0 h=0 e=17 h=7 e=0 h=1 e=0 10,10 12,11 5,5 8,8 15,11 6,6 17,14 3,3

Preflow Push Algorithm14 Example Relabel b with h=4  Push -4 along (a,b) e(a) = 4 s c ab t d h=6 h=3 e=0 h=4 e=4 h=0 e=17 h=7 e=0 h=1 e=0 10,10 12,11 5,5 8,8 15,15 6,6 17,14 3,3

Preflow Push Algorithm15 Example Relabel a with h=5  Push 4 along (a,b) e(b) = 4 s c ab t d h=6 h=5 e=4 h=4 e=0 h=0 e=17 h=7 e=0 h=1 e=0 10,10 12,11 5,5 8,8 15,11 6,6 17,14 3,3

Preflow Push Algorithm16 Example Relabel b with h=6  Push -4 along (a,b) e(a) = 4 s c ab t d h=6 h=5 e=0 h=6 e=4 h=0 e=17 h=7 e=0 h=1 e=0 10,10 12,11 5,5 8,8 15,15 6,6 17,14 3,3

Preflow Push Algorithm17 Example Relabel a with h=7  Push -4 along (s,a) e(a) = 0 s c ab t d h=6 h=7 e=4 h=6 e=0 h=0 e=17 h=7 e=0 h=1 e=0 10,10 12,11 5,5 8,8 15,11 6,6 17,14 3,3

Preflow Push Algorithm18 Example No active nodes left The algorithm terminates s c ab t d h=6 h=7 e=0 h=6 e=0 h=0 e=17 h=7 e=0 h=1 e=0 10,6 12,11 5,5 8,8 15,11 6,6 17,14 3,3 Min-cut

Preflow Push Algorithm19 Pseudo code  Worklist wl = initializePreflowPush();  while (!wl.isEmpty()) {  Node n = wl.remove();  n.relabel();  for (Node w in n.neighbors()) {  if (n can push flow to w) {  pushflow(n, w);  wl.add(w);  }  }  if (n has excess flow) {  wl.add(n);  }  }

Preflow Push Algorithm20 Amorphous Data Parallelism in Preflow Push Topology: graph Operator: local computation (data driven) Active nodes: nodes with excess flow Neighborhoods: active nodes and their neighbors Ordering: unordered Parallelism: Shoots in the beginning and then drops down  Dependent on number of active nodes

Preflow Push Algorithm21 Parallelism profile for Preflow Push Input Graph: 512x512 Grid

Preflow Push Algorithm22 Preflow Push: Global Relabeling The height of the nodes directs the flow towards the sink:  It affects the flow of fluid globally  But is updated locally  Which causes the fluid to flow in arbitrary directions  Increases the total number of push/relabel operations Global Relabeling:  After every N push/relabel operations we compute the height of every node from the sink  The height is computed by a breadth-first scan on the Residual Graph starting at the sink The height is incremented at each next level of BFS  It reduces the number of push/relabel operations significantly  N is determined heuristically

Preflow Push Algorithm23 Preflow Push: Global Relabeling s c ab t d h=6 h=2 e=0 h=1 e=0 h=0 e=17 h=2 e=0 h=1 e=

Preflow Push Algorithm24 Conclusion Preflow Push is an algorithm to find the max-flow in a graph It exhibits amorphous data parallelism  Parallelism is dependent on the structure of the graph