Maximum Flow by Incremental Breadth First Search

16
s Maximum Flow by Incremental Breadth First Search Sagi Hed Tel Aviv University Haim Kaplan Tel Aviv University Renato F. Werneck Microsoft Research Andrew V. Goldberg Microsoft Research Robert E. Tarjan Princeton University & HP Labs

description

Maximum Flow by Incremental Breadth First Search. Andrew V. Goldberg Microsoft Research. Sagi Hed Tel Aviv University. Haim Kaplan Tel Aviv University. s. Renato F. Werneck Microsoft Research. Robert E. Tarjan Princeton University & HP Labs. Maximum Flow. - PowerPoint PPT Presentation

Transcript of Maximum Flow by Incremental Breadth First Search

Page 1: Maximum Flow by Incremental Breadth First Search

s Maximum Flow byIncremental

Breadth First SearchSagi Hed

Tel Aviv UniversityHaim Kaplan

Tel Aviv University

Renato F. WerneckMicrosoft Research

Andrew V. GoldbergMicrosoft Research

Robert E. TarjanPrinceton University & HP Labs

Page 2: Maximum Flow by Incremental Breadth First Search

Maximum Flow• Input: directed 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 e f(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

Page 3: Maximum Flow by Incremental Breadth First Search

Maximum Flowin Computer Vision

• Graphs have specific structure

• Regular low degree grids• Arc capacities: different models for grid arcs and s-t arcs

Page 4: Maximum Flow by Incremental Breadth First Search

BKBoykov 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

considerable 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

Page 5: Maximum Flow by Incremental Breadth First Search

Our ContributionIBFS

We develop the IBFS algorithm –Incremental Breadth First Search

• Has many similarities to BK• 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(mn2)

Page 6: Maximum Flow by Incremental Breadth First Search

Augmenting Path Algorithms• Augmenting path algorithms constantly maintain a flow

function f, f constantly increases.• When the algorithm terminates f is maximal• Augmentation: add (maximal) X to flow along an s-t path• Residual graph:

Gf = (V,Ef)Ef = {(u,v) | (u,v) є E V f(u,v) < c(u,v)}

U {(v,u) | (u,v) є E V f(u,v) > 0}Extend f and c to f(v,u)=-f(u,v) and c(v,u)=0 for (u,v) є E

• Ford & Falkerson: augmentations in Gf give maximal flow

s

Page 7: Maximum Flow by Incremental Breadth First Search

BK Overview• Maintain trees S, T in the residual graph• Iterate 3 phases: Growth, Augmentation, Adoption• Growth: grow S and T bi-directionally

s t

S T

s

Page 8: Maximum Flow by Incremental Breadth First Search

BK Overview• Augmentation: when the trees meet, we augment flow• Adoption: after an augmentation, we try to reconnect

“orphaned” sub-trees

s t

S T

s

Page 9: Maximum Flow by Incremental Breadth First Search

IBFS Overview

• We maintain S, T as BFS trees with heights ≈ Ds , Dt

• Augment on shortest or nearly shortest paths (+1)

s t

S T

s

shortest+1

shortest

Page 10: Maximum Flow by Incremental Breadth First Search

IBFS Overview• Adoption / how to rebuild the trees:

If subtree reconnects at the same level, we’re done

s t

S TDs Dt

s

Page 11: Maximum Flow by Incremental Breadth First Search

IBFS OverviewOtherwise:• Relabel: set label to lowest potential parent + 1• Make children into orphan sub-trees

s t

S T

s

Page 12: Maximum Flow by Incremental Breadth First Search

IBFS Overview

BFS trees => worst case bound O(mn2)(must also maintain a current arc)

s

s t

S T

Page 13: Maximum Flow by Incremental Breadth First Search

IBFS vs. BK

• Maintaining BFS trees=> more work rebuilding the trees after each augmentation

• Shortest augmenting paths=> less work in each augmentation

• Shortest augmenting paths lead to less augmentations=> growth steps

• We get rid of the parent traversal step

s

Page 14: Maximum Flow by Incremental Breadth First Search

IBFS Experiments

• Ran on computer vision instancespublic benchmark [http://vision.csd.uwo.ca/maxflow-data/]our own creation [http://www.cs.tau.ac.il/~sagihed/ibfs/]

• BK implementation available publicly [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 outperforms BK on all but two instances:2 different capacity versions of the instance “bone”

• Factors are mostly modest. For few they are large.

s

Page 15: Maximum Flow by Incremental Breadth First Search

IBFS ExperimentsOT Orphans Growth Pushes

Speedup Instance BK BK IBFS BK IBFS BK IBFS

38.4 7.7 87.8 7.7 6.7 160.0 16.9 3 digged

126.5 43.9 601.7 25.4 7.3 353.2 108.4 1.11 hessi1a

43.7 13.3 129.6 10.2 6.3 122.2 33.0 1.24 house

83.3 27.3 348.3 17.3 6.8 153.0 53.5 1.07 anthra

23.0 6.8 30.1 8.8 ;6.8 10.9 2.8 1.17 bone_subx100

66.5 13.6 56.0 12.3 6.9 23.2 7.5 2.15 liver100

39.5 9.5 46.3 10.7 6.6 12.7 4.5 1.76 babyface100

7.0 5.1 35.6 8.1 6.9 2.0 0.5 0.79 bone100

0.6 0.4 0.6 6.2 6.2 0.5 0.3 1.23 bunny-med

61.2 13.0 92.4 9.4 6.8 74.0 20.4 1.54 camel-med

250.5 20.7 121.6 12.1 8.7 337.2 22.7 6.16 gargoyle-med

8.1 13.5 18.0 11.2 8.8 6.2 3.3 1.39 kz2-venus

s

Operation Counts (per vertex)

Page 16: Maximum Flow by Incremental Breadth First Search

THANK YOU!

s