98
Multiple-Source Multiple-Sink Maximum Flow in Directed Planar Graphs in Near-Linear Time Shay Mozes joint work with Cora Borradaile, Philip Klein,Yahav Nussbaum and Christian Wulff-Nilsen

Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Multiple-Source Multiple-Sink Maximum Flow in Directed Planar

Graphs in Near-Linear Time

Shay Mozes

joint work with Cora Borradaile, Philip Klein, Yahav Nussbaum and Christian Wulff-Nilsen

Page 2: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Graphs

Page 3: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Graphs

Page 4: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Graphs

Page 5: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Graphs

• arise in many applications

Page 6: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Graphs

• arise in many applications

• admit faster algorithms

Page 7: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Graphs

• arise in many applications

• admit faster algorithms

• interesting structural properties

Page 8: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Maximum Flow

input: a graph G with arc capacities and nodes s,t

output: an assignment of flow to arcs such that:

• conservation at non-terminals

• respects capacity at all arcs

• maximizes the amount of flow entering t

4

3

1

1

2

1

2 1

s

t

Page 9: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Maximum Flow

input: a graph G with arc capacities and nodes s,t

output: an assignment of flow to arcs such that:

• conservation at non-terminals

• respects capacity at all arcs

• maximizes the amount of flow entering t

4

3

1

1

2

1

2 1

s

t

Page 10: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Main Result

multiple-source, multiple-sink maximum flow in directed planar

graphs in O(n log3n) time.

Page 11: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Applications Multiple Sources and Sinks

• transportation networks (Soviet railroad system)

• computer vision - image segmentation, restoration, stereo, object recognition, texture synthesis (grid)

• maximum bipartite matching

Page 12: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Reduction to SingleSource and Sink

Page 13: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Reduction to SingleSource and Sink

Page 14: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Reduction to SingleSource and Sink

• reduction does not preserve planarity

• [Miller, Naor ’91] - sources and sinks on a small number of faces

Page 15: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Known Results for Single Source/Sink

general graphs: • Õ(nm) - many results (blocking flow, push relabel)• O(m3/2 log(n2/m) logU ) - [Goldberg, Rao ’97]

directed planar graphs:• O(n) - s and t on the same face [Hassin ’81+

Henzinger et al. ’94]• O(n log n) [Borradaile, Klein ’06]

Page 16: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Outline

• a few tools and definitions

• high-level description of recursive algorithm

• main ingredients for near-linear time

Page 17: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Multiple Sinks on a path

Page 18: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Multiple Sinks on a path

reduces to the single sink case - connect all sinks with infinite-capacity edges

preserves planarity!

Page 19: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

The Residual Graph

• given flow f in graph G with capacities c(a), the residual graph Gf has same nodes and arcs as G and capacities cf (a) = c(a) - f(a)

• a path P is residual if every arc of P has positive capacity

010

Page 20: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

The Residual Graph

• given flow f in graph G with capacities c(a), the residual graph Gf has same nodes and arcs as G and capacities cf (a) = c(a) - f(a)

• a path P is residual if every arc of P has positive capacity

100

46

Page 21: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

1 100

0 3

s1 s2

t

a flow f is maximum iff there are no residual paths from sources to sinks in Gf

Page 22: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

0 101

1 2

s1 s2

t

a flow f is maximum iff there are no residual paths from sources to sinks in Gf

0 310

Page 23: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

0 011

2 1

s1 s2

t

a flow f is maximum iff there are no residual paths from sources to sinks in Gf

0 310

10

Page 24: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Zoo• excess flow at node v is the difference between amount of flow

entering v and leaving vconservation ⇒ excess flow is zero

• pseudoflow: arc capacities are respected (conservation may not)

• feasible flow: pseudoflow that obeys conservation everywhere except sources and sinks

• circulation: pseudoflow that obeys conservation everywhere (even at sources and sinks)

• given a pseudoflow, it is possible to push back all positive/negative excess flow to/from its origin in linear time

Page 25: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

1 100

0 3

s1 s2

t

think of sources as having excess flow +∞think of sinks as having excess flow -∞

a pseudoflow corresponds to a maximum flow iff there are no residual paths from + to - in the residual graph

Page 26: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

think of sources as having excess flow +∞think of sinks as having excess flow -∞

a pseudoflow corresponds to a maximum flow iff there are no residual paths from + to - in the residual graph

3 0

s1 s2

t

0 310

10-3

Page 27: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

think of sources as having excess flow +∞think of sinks as having excess flow -∞

a pseudoflow corresponds to a maximum flow iff there are no residual paths from + to - in the residual graph

3 0

s1 s2

t

0 3

-10 0

1110

10

Page 28: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Cycle Separators [Miller ’86]

• simple cycle in a triangulated 2-connected planar graph

• balanced - between n/3 and 2n/3 nodes on each side

• small: consists of O(√n) nodes

• can be found in O(n) time

n/2

!n

n/2

Page 29: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Outline

• a few tools and definitions

• high-level description of recursive algorithm

• main ingredients for near-linear time

Page 30: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Recursion, First try

s3

s2

s1

t3

t2

t1

Page 31: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, First try

• find separator

Page 32: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, First try

• find separator• find maximum MSMS flow

inside and outsider recursively

Page 33: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, First try

• find separator• find maximum MSMS flow

inside and outsider recursively

• no residual paths from sources to sinks in each subgraph

Page 34: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, Second try

Page 35: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator

Page 36: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths:• from sources to sinks• from sources to separator• from separator to sinks

Page 37: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

+

-

+ s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

Page 38: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

+

-

- s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

Page 39: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

+

-

- s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

• eliminate residual paths from + to - on separator

Page 40: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

+

-

- s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

• eliminate residual paths from + to - on separator

Page 41: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

+

-

- s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

• eliminate residual paths from + to - on separator

• return flow from + to sources and from sinks to -

Page 42: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

• eliminate residual paths from + to - on separator

• return flow from + to sources and from sinks to -

Page 43: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recursion, Second try

• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

• eliminate residual paths from + to - on separator

• return flow from + to sources and from sinks to -

Page 44: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Fixing the Separatoreliminate residual paths from + to - on separator

-

+

+

+

+

+

-

-

+

Page 45: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

-

+

+

+

+

+

-

-

+

Fixing the Separatoreliminate residual paths from + to - on separator

• make capacity of separator edges infinite

• handle nodes one by one:

Page 46: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

-

+

+

+

+

+

-

-

+

Fixing the Separatoreliminate residual paths from + to - on separator

• make capacity of separator edges infinite

• handle nodes one by one:

• reduce capacity of incident edges back to original

Page 47: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

-

+

+

+

+

+

-

-

+

Fixing the Separatoreliminate residual paths from + to - on separator

• make capacity of separator edges infinite

• handle nodes one by one:

• reduce capacity of incident edges back to original

• push + excess to neighbor using max-flow in residual graph

Page 48: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

-

+

+

+

+

+

-

-

+

Fixing the Separatoreliminate residual paths from + to - on separator

• make capacity of separator edges infinite

• handle nodes one by one:

• reduce capacity of incident edges back to original

• push + excess to neighbor• push - excess from neighbor using

max-flow in residual graph

Page 49: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

-

+

-

+

+

+

-

-

+

Fixing the Separatoreliminate residual paths from + to - on separator

• make capacity of separator edges infinite

• handle nodes one by one:

• reduce capacity of incident edges back to original

• push + excess to neighbor• push - excess from neighbor using

max-flow in residual graph

Page 50: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

-

+

-

+

+

+

-

-

+

Fixing the Separatoreliminate residual paths from + to - on separator

• make capacity of separator edges infinite

• handle nodes one by one:

• reduce capacity of incident edges back to original

• push + excess to neighbor• push - excess from neighbor

running time:

separator nodes time for max-flow between neighbors [Hassin + Henzinger et al.]

O(!n) ·O(n) = O(n3/2)

Page 51: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Outline

• a few tools and definitions

• high-level description of recursive algorithm

• main ingredients for near-linear time

Page 52: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

bottleneck is fixing step which consists of max-flow computations in residual graph between neighbor nodes on a simple cycle

can represent the flow compactly:flow is in graph with edges representation has size maintain flow only on separator edgesflow elsewhere represented implicitly

⇒ can perform each max-flow computation

in instead of

-

+

+

+

+

+

-

-

+

Near Linear TimeO(

!n)

O(!n log2 n) O(n)

O(n)O(

!n)

Page 53: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Duality

Page 54: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Duality

Page 55: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Planar Duality

Page 56: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s

t

to compute max flow from s to t:

Max-Flow between Neighbors[Hassin 1981]

Page 57: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

to compute max flow from s to t:

• make capacity of arc ts infinite

s

t

Page 58: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

s

t

!0

to compute max flow from s to t:

• make capacity of arc ts infinite• φ0 = the face to the left of arc ts

Page 59: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

s

t

!0

to compute max flow from s to t:

• make capacity of arc ts infinite• φ0 = the face to the left of arc ts• consider capacity of an arc in the

primal as its length in the dual

Page 60: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

to compute max flow from s to t:

• make capacity of arc ts infinite• φ0 = the face to the left of arc ts• consider capacity of an arc in the

primal as its length in the dual• compute:

d(φ) = distance of φ from φ0 in dual

Page 61: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

to compute max flow from s to t:

• make capacity of arc ts infinite• φ0 = the face to the left of arc ts• consider capacity of an arc in the

primal as its length in the dual• compute:

d(φ) = distance of φ from φ0 in dual• define flow on arc a by:σ(a) = d(face right of a) - d(face left of a)σ is a feasible circulation that maximizes the flow on arc ts

Page 62: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

σ is a feasible circulation

Page 63: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

σ is a feasible circulationconservation:σ(a) = d(face right of a) - d(face left of a)flows on arcs outgoing from a node cancel to zero

2

6

410

9

11

Page 64: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

feasibility guaranteed by shortest paths inequality:

σ is a feasible circulationconservation:σ(a) = d(face right of a) - d(face left of a)flows on arcs outgoing from a node cancel to zero

2

6

410

9

11

Page 65: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

feasibility guaranteed by shortest paths inequality:d(head of dual of a) ≤ d(tail of dual of a) + length(dual of a)

σ is a feasible circulationconservation:σ(a) = d(face right of a) - d(face left of a)flows on arcs outgoing from a node cancel to zero

2

6

410

9

11

Page 66: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

feasibility guaranteed by shortest paths inequality:d(head of dual of a) ≤ d(tail of dual of a) + length(dual of a)d(head of dual of a) - d(tail of dual of a) ≤ capacity of a

σ is a feasible circulationconservation:σ(a) = d(face right of a) - d(face left of a)flows on arcs outgoing from a node cancel to zero

2

6

410

9

11

Page 67: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

feasibility guaranteed by shortest paths inequality:d(head of dual of a) ≤ d(tail of dual of a) + length(dual of a)d(head of dual of a) - d(tail of dual of a) ≤ capacity of a

σ(a) = d(face right of a) - d(face left of a) = d(head of dual of a) - d(tail of dual of a) ≤ capacity of a

σ is a feasible circulationconservation:σ(a) = d(face right of a) - d(face left of a)flows on arcs outgoing from a node cancel to zero

2

6

410

9

11

Page 68: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

to compute max flow from s to t:

• make capacity of arc ts infinite• φ0 = the face to the left of arc ts• consider capacity of an arc in the

primal as its length in the dual• compute:

d(φ) = distance of φ from φ0 in dual• define flow on arc a by:σ(a) = d(face right of a) - d(face left of a)σ is a feasible circulation that maximizes the flow on arc ts

Page 69: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Max-Flow between Neighbors[Hassin 1981]

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

to compute max flow from s to t:

• make capacity of arc ts infinite• φ0 = the face to the left of arc ts• consider capacity of an arc in the

primal as its length in the dual• compute:

d(φ) = distance of φ from φ0 in dual• define flow on arc a by:σ(a) = d(face right of a) - d(face left of a)σ is a feasible circulation that maximizes the flow on arc ts

• don’t push flow on ts

Page 70: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

tFlow Representation 1/4

Page 71: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

flow between endpoints of arc ai of C can be represented by:

Flow Representation 1/4

Page 72: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ

Flow Representation 1/4

Page 73: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

0 2

5

6

410

11

11

7

910

12

13

2

56

9

s

t

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ• flow on ai

Flow Representation 1/4

Page 74: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ• flow on ai

Flow Representation 1/4

Page 75: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ• flow on ai

to represent sum of flows for all iterations of fixing step:

Flow Representation 1/4

Page 76: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ• flow on ai

to represent sum of flows for all iterations of fixing step:• accumulate face labels over all iterations (linearity)

Flow Representation 1/4

Page 77: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ• flow on ai

to represent sum of flows for all iterations of fixing step:• accumulate face labels over all iterations (linearity)• explicitly store flow on arcs of separator C

Flow Representation 1/4

Page 78: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

flow between endpoints of arc ai of C can be represented by:• face labels di(φ) for each face φ• flow on ai

to represent sum of flows for all iterations of fixing step:• accumulate face labels over all iterations (linearity)• explicitly store flow on arcs of separator C

will show it suffices to store face labels for just the faces adjacent to separator C

Flow Representation 1/4

Page 79: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

f0 - flow after recursive callsf - flow on C’s arcs up to current iteration d - accumulated face labels up to current iteration

Flow Representation 2/4

Page 80: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

f0 - flow after recursive callsf - flow on C’s arcs up to current iteration d - accumulated face labels up to current iteration

Flow Representation 2/4

Page 81: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

f0 - flow after recursive callsf - flow on C’s arcs up to current iteration d - accumulated face labels up to current iteration

• for an arc a not on C, flow is: f0(a) + d(face right of a) - d(face left of a)

Flow Representation 2/4

Page 82: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

f0 - flow after recursive callsf - flow on C’s arcs up to current iteration d - accumulated face labels up to current iteration

• for an arc a not on C, flow is: f0(a) + d(face right of a) - d(face left of a)

• residual capacity of a is: c(a) - f0(a) - d(face right of a) + d(face left of a)

Flow Representation 2/4

Page 83: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

f0 - flow after recursive callsf - flow on C’s arcs up to current iteration d - accumulated face labels up to current iteration

• for an arc a not on C, flow is: f0(a) + d(face right of a) - d(face left of a)

• residual capacity of a is: c(a) - f0(a) - d(face right of a) + d(face left of a)

• length of dual of a is: c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a)

Flow Representation 2/4

Page 84: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

• length of dual of a is: c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a)

Flow Representation 3/4

Page 85: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

• length of dual of a is: c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a)

Flow Representation 3/4

Page 86: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

• length of dual of a is: c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a)

• length of any dual path P that does not use dual arcs of C is: ∑ c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a) = d(end of P) - d(start of P) + ∑c(a) - f0(a)

Flow Representation 3/4

Page 87: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

• length of dual of a is: c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a)

• length of any dual path P that does not use dual arcs of C is: ∑ c(a) - f0(a) - d(head of dual of a) + d(tail of dual of a) = d(end of P) - d(start of P) + ∑c(a) - f0(a)

• ignoring arcs of C, shortest paths are independent of dnote: length of shortest path does change by d(end of P) - d(start of P)

Flow Representation 3/4

Page 88: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Representation 4/4

• X = set of faces adjacent to separator C = set of endpoints of dual arcs of C

Page 89: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Representation 4/4

Page 90: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Representation 4/4

• X = set of faces adjacent to separator C = set of endpoints of dual arcs of C

• H - dual graph without dual arcs of C

Page 91: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Representation 4/4

• X = set of faces adjacent to separator C = set of endpoints of dual arcs of C

• H - dual graph without dual arcs of C

• any shortest path in dual graph can be decomposed into:- shortest paths in H- dual arcs of C

Page 92: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Representation 4/4

• X = set of faces adjacent to separator C = set of endpoints of dual arcs of C

• H - dual graph without dual arcs of C

• any shortest path in dual graph can be decomposed into:- shortest paths in H- dual arcs of C

• precompute all-pair shortest paths between nodes of X in H- can be done in O(n log n) time [Klein SODA’05]- these shortest paths do not change- for x,y ∈ X, length of x-to-y path changes by d(x) - d(y)

Page 93: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Flow Representation 4/4

• X = set of faces adjacent to separator C = set of endpoints of dual arcs of C

• H - dual graph without dual arcs of C

• any shortest path in dual graph can be decomposed into:- shortest paths in H- dual arcs of C

• precompute all-pair shortest paths between nodes of X in H- can be done in O(n log n) time [Klein SODA’05]- these shortest paths do not change- for x,y ∈ X, length of x-to-y path changes by d(x) - d(y)

• suffices to maintain face labels for X and explicit flow for C

Page 94: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Efficient Implementation• precompute all-pair shortest paths

between nodes of X in H O(n) pairs• maintain:

- face labels for X faces- explicit flow for C arcs

• can implement Dijkstra’s algorithm with this representation in time using a modification of a data-structure of Fakcharoenphol and Rao [FOCS’01]

O(!n)

O(!n)

O(!n log2 n)

running time:

separator nodes time for max-flow between neighbors using compact representation

O(!n) ·O(

!n log2 n) = O(n log2 n)

Page 95: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Back to the Entire Graph

• with compact representation we have:- explicit flow f on all arcs of C- accumulated face labels only for faces adjacent to C

• need to extend face labels to all faces• can be done using one more shortest-path computation in

the dual which takes linear time

Page 96: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

s3

s2

s1

t3

t2

t1

Recall High-Level Algorithm• find separator• recursive problem (almost):

eliminate residual paths• from sources to sinks• from sources to separator• from separator to sinks

• eliminate residual paths from + to - on separator

• return flow from + to sources and from sinks to -

running time: O(n log3n)

Page 97: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Open Questions/Directions• can running time be improved?

(bottleneck is Fakcharoenphol and Rao’s data structure and its modification)

• can this technique be adapted to bounded-genus graphs?• implementation

Page 98: Multiple-Source Multiple-Sink Maximum Flow in Directed ...smozes/msms2slides.pdf · Maximum Flow input: a graph G with arc capacities and nodes s,t output: an assignment of flow

Thank You!

3 0

s1 s2

t

0 3

-1

0 0

11

1

0

1

0

s3

s2

s1

t3

t2

t1