Download presentation

Presentation is loading. Please wait.

Published byBrionna Peeke Modified over 2 years ago

1
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

2
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

3
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]

4
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)

5
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

6
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

7
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 )

8
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

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

10
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

11
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

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

13
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

14
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

15
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

16
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

17
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

18
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

19
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

20
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

21
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

22
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

23
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

24
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

25
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

26
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

27
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

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

29
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

30
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

31
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

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

33
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

34
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

35
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

36
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

37
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

38
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

39
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

40
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

41
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

42
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

43
IBFS Experiments Ran on 37 computer vision instances, different families 27 public benchmark [http://vision.csd.uwo.ca/maxflow-data/] 10 our own creation [http://www.cs.tau.ac.il/~sagihed/ibfs/]http://vision.csd.uwo.ca/maxflow-data/http://www.cs.tau.ac.il/~sagihed/ibfs/ BK implementation available publicly [http://vision.csd.uwo.ca/code/]http://vision.csd.uwo.ca/code/ 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

44
IBFS Experiments s Running Time (seconds)

45
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

46
IBFS Experiments OTOrphansGrowthPushes SpeedupInstance BK IBFSBKIBFSBKIBFS 38.47.787.87.76.7160.016.93digged 126.543.9601.725.47.3353.2108.41.11hessi1a 43.713.3129.610.26.3122.233.01.24house 83.327.3348.317.36.8153.053.51.07anthra 23.06.830.18.86.810.92.81.17bone_subx100 66.513.656.012.36.923.27.52.15liver100 39.59.546.310.76.612.74.51.76babyface100 7.05.135.68.16.92.00.50.79bone100 0.60.40.66.2 0.50.31.23bunny-med 61.213.092.49.46.874.020.41.54camel-med 250.520.7121.612.18.7337.222.76.16gargoyle-med 8.113.518.011.28.86.23.31.39kz2-venus s Operation Counts (per vertex)

47
IBFS Experiments On non computer-vision graph families [http://www.avglab.com/andrew/CATS/maxflow_synthetic.htm] IBFS outperforms BK, some by large factorshttp://www.avglab.com/andrew/CATS/maxflow_synthetic.htm On these, standard Push-Relabel implementation outperforms both IBFS and BK. s

48
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.

49
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?

50
s

Similar presentations

Presentation is loading. Please wait....

OK

Chapter 7 April 28 Network Flow.

Chapter 7 April 28 Network Flow.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Good backgrounds for ppt on social media Ppt on attendance management system using rfid Ppt on the road not taken audio Ppt on producers consumers and decomposers in the ocean Ppt on cse related topics about computer Ppt on business ethics and social responsibility Ppt on ramayana in sanskrit Ppt on hiv aids prevention Ppt on mary kay ash Ppt on low level language example