S Maximum Flow by Incremental Breadth First Search Joint work with:Haim KaplanRobert E. Tarjan Tel Aviv University Princeton University & HP Labs Renato.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Min Cost Flow: Polynomial Algorithms. Overview Recap: Min Cost Flow, Residual Network Potential and Reduced Cost Polynomial Algorithms Approach Capacity.
Single Source Shortest Paths
Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
§3 Shortest Path Algorithms Given a digraph G = ( V, E ), and a cost function c( e ) for e  E( G ). The length of a path P from source to destination.
15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Chapter 5 Shortest Paths: Label-Correcting Algorithms
MINIMUM COST FLOWS: NETWORK SIMPLEX ALGORITHM A talk by: Lior Teller 1.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
15.082J, 6.855J, and ESD.78J Sept 16, 2010 Lecture 3. Graph Search Breadth First Search Depth First Search Intro to program verification Topological Sort.
S Maximum Flow by Incremental Breadth First Search Sagi Hed Tel Aviv University Haim Kaplan Tel Aviv University Renato F. Werneck Microsoft Research Andrew.
1 s-t Graph Cuts for Binary Energy Minimization  Now that we have an energy function, the big question is how do we minimize it? n Exhaustive search is.
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 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Maurizio Patrignani seminar on the paper on the single-source unsplittable flow problem authored by Yefim Dinitz Naveen Garg Michel X. Goemans FOCS ‘98.
Lectures on Network Flows
1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 7 Maximum Flows: Polynomial Algorithms
1 Efficient implementation of Dinic’s algorithm for maximum flow.
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
The max flow problem
Stereo Computation using Iterative Graph-Cuts
1 Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
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.
15.082J, 6.855J, and ESD.78J September 21, 2010 Eulerian Walks Flow Decomposition and Transformations.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
1 Binomial heaps, Fibonacci heaps, and applications.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
“On an Algorithm of Zemlyachenko for Subtree Isomorphism” Yefim Dinitz, Alon Itai, Michael Rodeh (1998) Presented by: Masha Igra, Merav Bukra.
Minimum Cost Flows. 2 The Minimum Cost Flow Problem u ij = capacity of arc (i,j). c ij = unit cost of shipping flow from node i to node j on (i,j). x.
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
The minimum cost flow problem. Simplifying assumptions Network is connected (as an undirected graph). – We can consider each connected component separately.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
1 WEEK 11 Graphs III Network Flow Problems A Simple Maximum-Flow Algorithm Izmir University of Economics.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
Algorithm Design and Analysis (ADA)
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Outline Standard 2-way minimum graph cut problem. Applications to problems in computer vision Classical algorithms from the theory literature A new algorithm.
15.082J & 6.855J & ESD.78J September 30, 2010 The Label Correcting Algorithm.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
1 Maximum Flows CONTENTS Introduction to Maximum Flows (Section 6.1) Introduction to Minimum Cuts (Section 6.1) Applications of Maximum Flows (Section.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Ford-Fulkerson Recap.
Binomial heaps, Fibonacci heaps, and applications
Lectures on Network Flows
Edmunds-Karp Algorithm: Choosing Good Augmenting Paths
James B. Orlin Presented by Tal Kaminker
Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Analysis of Algorithms
3.4 Push-Relabel(Preflow-Push) Maximum Flow Alg.
Primal-Dual Algorithm
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
and 6.855J March 6, 2003 Maximum Flows 2
Binomial heaps, Fibonacci heaps, and applications
Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Max Flows 3 Preflow-Push Algorithms
Class 11 Max Flows Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow.
Presentation transcript:

s Maximum Flow by Incremental Breadth First Search Joint work with:Haim KaplanRobert E. Tarjan Tel Aviv University Princeton University & HP Labs Renato F. WerneckAndrew V. Goldberg Microsoft ResearchMicrosoft Research Sagi Hed Tel Aviv University

Maximum Flow Input: graph G=(V,E), vertices s, t є V and capacity assignment c(e) for e є E Output: flow function f satisfying - conservation: for every v≠s,t Σ (u,v)єE f(u,v) = Σ (v,u)єE f(v,u) capacity:for every ef(e) ≤ c(e) with maximal |f|=sum of flow out of s (into t) Well studied problem Equivalent to the Minimum s-t Cut problem Solution methods: Augmenting Path (and blocking flow), Network Simplex, Push-Relabel

Push-Relabel A different approach – Push vs. augment path, pre-flow vs. flow [Goldberg, Tarjan 88] Some Push-Relabel bounds: O(mn 2 )Any active vertex selection O(n 3 )FIFO active vertex selection O(n 2 m ½ )Highest label active vertex selection O(mn log(n 2 /m))with dynamic trees Push-Relabel considered the most efficient general- purpose solution in practice [Cherkassky, Goldberg 97]

Maximum Flow in Computer Vision Minimum s-t cut very useful in the field of computer vision Applications in image segmentation, stereo image processing, video transitioning… Typical Process – 2D or 3D images are converted to input graphs, where each vertex corresponds to a pixel Minimum s-t cut on these graphs provides information on the original image(s)

Maximum Flow in Computer Vision These graphs have specific structure Regular low degree grids Arc capacities: different models for grid arcs and s-t arcs

BK Boykov and Kolmogorov developed an algorithm (BK) which is the fastest in practice on the vision instances [Boykov, Kolmogorov 04] Used as the standard min-cut algorithm in computer vision Usually outperforms Push-Relabel implementation by large factors Problem: BK has no known polynomial time guarantee… Best bound is O(mnF) for integral capacities (F is the maximal flow value) Indeed on some instances, BK performs poorly and is outperformed by Push-Relabel implementation

Our Contribution IBFS We develop the IBFS algorithm – Incremental Breadth First Search Has many similarities to BK and to Dinitz However, performs shortest path or nearly shortest path augmentations Competative in practice to BK Usually outperforms BK by small factors Has a polynomial worst case time guarantee O(mn 2 )

BK Overview Grows trees S, T in the residual graph bi-directionally We maintain a list of active nodes, from which the trees can grow s t ST active nodes s

BK Overview When the trees meet, we augment flow After an augmentation, we try to rebuild the trees s t ST s active nodes

BK Drill Down Initially: S={s}, T={t}, active node list = {s,t} Iterates between 3 phases: Growth, Augmentation, Adoption s s t S T

BK Drill Down Growth: Iterate through active node list and grow S,T Add new vertices to the back of the active list (FIFO) s t S T t s s

BK Drill Down Augment: Discover other tree during growth => augment flow Saturated tree arcs create orphan sub-trees S T s t Orphan s

BK Drill Down Adoption: (symmetric for S and T) Iterate over orphans and check potential parents If an orphan finds a parent its entire subtree is reattached t v s

BK Drill Down Adoption: Checking a potential parent u: traverse the path from u to the root, no orphans on the path t v s

BK Drill Down Adoption: Orphan v does not reconnect - Remove v from tree and make children orphans Make potential parents active Make v inactive t v s

BK Drill Down Continue Growth, Augmentation, Adoption The trees are no longer neccesarily BFS trees Augmenting paths are no longer neccesarily shortest Growth alternates between S and T s t ST s

BK Drill Down Termination: No more active nodes (either in S or in T) Maximum flow value is the total augmented flow s t ST s

IBFS Overview We maintain S, T as BFS trees with heights ≈ D s, D t Active nodes are on level D s or D t only Augment on shortest (D s +D t +1) paths only (later nearly shortest paths) s t ST DsDs DtDt s

IBFS Overview Vertex v has label d s (v) ≤ D s +1 and a label d t (v) ≤ D t +1 d s (v) and d t (v), are the level of the tree v is in d s (v) is meaningful if v ϵ S, d t (v) is meaningful if v ϵ T s t ST DsDs DtDt s

IBFS Drill Down Initially: S={s}, T={t}, active node list = {s,t} d s (s)=0, d t (t)=0, D s =0, D t =0 As in BK, iterates between 3 phases: Growth, Augmentation, Adoption s t S T s

IBFS Drill Down Growth: Grow one complete level at a time, D s ++ or D t ++ If u grows v, d s (v) = d s (u)+1 / d t (v) = d t (u)+1 Can alternate forward/backward passes arbitrarily s t S T t s d s =0d s =1d s =2 d t =2d t =1d t =0 s

IBFS Drill Down Augment: As in BK, Discover other tree during growth => augment flow Saturated tree arcs create orphan sub-trees S T s t Orphan d s =0d s =1d s =2 d t =2d t =1d t =0 s

IBFS Drill Down Adoption: (symmetric for S and T) Iterate over orphans and check potential parents If orphan v finds a parent u with d t (u)=d t (v)-1 v’s subtree reconnects t v d t =2d t =1d t =0 s

IBFS Drill Down Adoption: Orphan v does not reconnect at same level – Relabel(v): d t (v)=min{d t (u)|uϵT, (u,v) residual}+1 parent(v) = argmin{...} Make children orphans Make v inactive t v v d t =2d t =1d t =0 s

IBFS Drill Down Adoption: (symmetric for S and T) Remove v from T, if Relabel(v) does not find a parent or Relabel(v) finds a parent u such that – forward pass: d t (u) ≥ D t backward pass: d t (u) ≥ D t +1 t v d t =1d t =0d t =D t =2 v s

IBFS Drill Down Adoption: (symmetric for S and T) Orphan v may reconnect to an orphan subtree (its own or another) If neccesary processed as an orphan again later t v d t =2d t =1d t =0 v s

IBFS Drill Down Continue Growth, Augmentation, Adoption The trees are always maintained as BFS trees Shortest augmenting paths = D s +D t +1 (proof soon) Alternate between forward/backward passes s t ST s impossible DsDs DtDt

IBFS Drill Down Termination: Empty level (either in S or in T) Maximum flow value is the total augmented flow s t ST s

IBFS vs. Dinitz Basically a form of Dinitz Bi-directional rather than uni-directional Auxilary network for next passes prepared while processing current pass. Network not rebuilt from scratch every pass! s

IBFS Drill Down Current Arc (time efficiency only) Remeber where the last orphan parent scan stopped When v is added to the tree, current arc = first arc current_arc(v) ϵ {first_arc(v), (parent(v),v)} => can be implemented with a bit s s S Current Arc

IBFS Correctness Lemma 1: (symmetric for forward / backward passes) If (u,v) is residual During a forward pass – u in S, v not in S, d s (u) ≤ D s => u active(d s (u)=D s ) After we increase D s until the next forward pass – u in S, v not in S=> d s (u)=D s s S v s uu v u DsDs

IBFS Correctness By Lemma 1, when the algorithm terminates there are no more residual augmenting paths => the flow is maximal s s t ST

IBFS Time Bound Definition: u,v in S, (u,v) is admissible: (u,v) is residual and d s (v) = d s (u)+1 Algorithm Invariants: (symmetric for d s and d t ) 1.Tree arcs are admissible 2.current arc of u precedes the first admissible arc to u 3.d s is a valid labeling: (u,v) residual => d s (v) ≤ d s (u)+1 4.d s (v) never decreases s s

IBFS Time Bound Algorithm Invariants Proof: By induction on the algorithm steps. Valid d s labeling (invariant 3): Growth step: By Lemma 1, there are no connections from lower levels Augmentation: New residual arcs do not violate, by inductive assumption of admissible tree arcs Adoption: Orphan relabel does not break valid labeling (as in push-relabel) s

IBFS Time Bound Conclusions from Algorithm Invariants: (not directly needed for analysis) S and T are BFS trees: d s (v) = the distance from s to v in the residual graph d t (v) = the distance from v to t in the residual graph We always augment on shortest paths in the residual graph s

IBFS Time Bound Lemma 2: (symmetric for S and T) After an orphan relabel on v in S, d s (v) increases. If v is removed from S, then we consider the increased label the next time v is added to S. Lemma 2 Proof: Easy, except to avoid pathalogical case of adoption/growth s s v d s =2d s =1d s =0

IBFS Time Bound Lemma 2 Proof: Let U ≡ {u | u in S and (u,v) is residual} Let d s ’(v)=d s (v) at time of relabel(v) By valid labeling and current arc invariants – If new_parent(v) ϵ U => d s (new_parent(v)) ≥ d’ s (v) => d s (v) = d s (new_parent(v))+1 ≥ d’ s (v)+1 By non-decreasing labels invariant, this is true at any future time s

IBFS Time Bound Lemma 3: IBFS runs in O(n 2 m) time Lemma 3 Proof: (symmetric for S and T) Note there are ≤ n-1 different values for d s (v) Growth We charge the scan of arc (u,v) to d s (u) Each label charged by arc (u,v) at most once (u becomes inactive) Total: O(nm) s

IBFS Time Bound Lemma 3 Proof continued: (symmetric for S and T) Adoption We charge the scan of arc (u,v) (v orphan) to d s (v) Each label charged by arc (u,v) at most twice – Once during scanning for a parent with label d s (v)-1 (due to remembering the current arc) Once during orphan relabel (by Lemma 2) Total: O(nm) s

IBFS Time Bound Lemma 3 Proof continued: (symmetric for S and T) Augmentation Let (u,v) be an arc saturated in the augmentation. If (u,v) is a tree arc, we create an orphan – no more than charges made for adoption=> O(nm) If (u,v) is not a tree arc (u ϵ S, v ϵ T), we charge d s (u) Each label is charged by arc (u,v) at most once (u becomes inactive)=> O(nm) Each augmentation takes O(n) time Total: O(n 2 m)□ s

IBFS Variants Nearly Shortest Path Vertices at level D s in S and D t in T are activated together We grow both trees at the same time, intermittently Augmenting paths are shortest or “shortest+1” More similar to BK s S T s t d s =0d s =1d s =D s =2 d t =D t =2d t =1d t =0 D s +D t +2

IBFS Variants Nearly Shortest Path Passes are both forward and reverse at the same time Correctness and running time are proved in the same way after applying the above rule Proves best in practice Used in our implementation and experiments s

IBFS Experiments Ran on 37 computer vision instances, different families 27 public benchmark [ 10 our own creation [ BK implementation available publicly [ We compare to a modified version of BK, with the same low level optimizations as our own (≈ 20% faster) IBFS wins on 35 out of 37 2 different capacity versions of the instance “bone” Factors are mostly modest. For few they are large. s

IBFS Experiments s Running Time (seconds)

IBFS Experiments 4 operations counted: Pushes – sum of augmentation lengths Growth arc scans – number of arcs scanned during growth Orphan arc scans – number of arcs scanned during adoption Orphan traversal to root (BK) – number of arcs traverse to check the root of the potential parent’s tree Growth and Orphan arc scans access arcs sequentially in memory Pushes and Orphan traversal to root access arcs non- sequentially in memory s Operation Counts

IBFS Experiments OTOrphansGrowthPushes SpeedupInstance BK IBFSBKIBFSBKIBFS digged hessi1a house anthra bone_subx liver babyface bone bunny-med camel-med gargoyle-med kz2-venus s Operation Counts (per vertex)

IBFS Experiments On non computer-vision graph families [ IBFS outperforms BK, some by large factorshttp:// On these, standard Push-Relabel implementation outperforms both IBFS and BK. s

Summary BK works well on computer vision problems in practice, but does not provide a polynomial run time guarantee IBFS works as well in practice and provides a polynomial run time guarantee IBFS operates similarly to BK, and can also be viewed as a bi-directional version of Dinitz where the auxiliary network is constantly recovered rather than rebuilt.

Open Question Can you find a maximum-flow algorithm with a polynomial time bound, which is competitive in practice with both Push-Relabel and BK on all graph families?

s