minimum weight cycle

46
Minimum Weight Cycle Liam Roditty Bar-Ilan University Based on : • Approximating the girth, (SODA`11) with Roei Tov (BIU) • Minimum Weight Cycles and Triangles: Equivalences and Algorithms, with Virginia V. Williams (UC Berkeley)

Upload: norm

Post on 11-Jan-2016

27 views

Category:

Documents


1 download

DESCRIPTION

Minimum Weight Cycle. Liam Roditty Bar-Ilan University. Based on: Approximating the girth, (SODA`11) with Roei Tov (BIU) Minimum Weight Cycles and Triangles: Equivalences and Algorithms, with Virginia V. Williams (UC Berkeley). Problem Definition. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Minimum  Weight Cycle

Minimum Weight Cycle

Liam RodittyBar-Ilan University

Based on:

• Approximating the girth, (SODA`11) with Roei Tov (BIU)• Minimum Weight Cycles and Triangles:

Equivalences and Algorithms, with Virginia V. Williams (UC Berkeley)

Page 2: Minimum  Weight Cycle

Problem DefinitionGiven a graph G=(V,E) find the Minimum Weight Cycle (Min-Cycle) in the graph.Variants: • Undirected / Directed • Unweighted / Weighted • Exact / Approximation • With or without Fast Matrix Multiplication (FMM)

Page 3: Minimum  Weight Cycle

The Trivial Algorithm

• Directed graphs: – Compute All-Pairs of Shortest Paths

(APSP).

– Min-Cycle = min(u,v)Ed[v,u] + w(u,v)

v u

Page 4: Minimum  Weight Cycle

The Trivial Algorithm

• Undirected graphs:– Dijkstra/BFS from every vertex of the

graph– Pick the minimum cycle detectedExample (unweighted): v u

s

In both cases the running time is Õ(n³).

Page 5: Minimum  Weight Cycle

Previous Work (1)

Itai & Rodeh (SICOMP 1978) considered only unweighted graphs:• Min-Cycle in undirected graphs in O(nω) time.• Min-Cycle in directed graphs in O(nωlog n) time.• Approximation in undirected graphs in O(n²)

time. – Return a min-cycle or a cycle whose length is larger by

one from the minimum.

Page 6: Minimum  Weight Cycle

Previous Work (2)

Yuster & Zwick (SIDMA 1997) presented an algorithm

that finds the shortest even cycle in unweighted undirected graphs in O(n²) time.

Page 7: Minimum  Weight Cycle

Previous Work (3)

Lingas & Lundell (IPL 2009) presented two approximation algorithms for undirected graphs:• For unweighted graphs an Õ(n3/2) algorithm that

returns a 2.666…-approximation. • For weighted graphs with integral edge weights

[1,M] an O(n² log n log nM) algorithm that returns a

2-approximation.

Page 8: Minimum  Weight Cycle

Previous Work (4)

V. Williams & Williams (FOCS 2010) showed that if a Min-Cycle in an undirected graph with weights [1,M] can be found in O(n3-δ log M) for some δ>0 then it is possible to compute APSP in a directed graph with weights [-M,M] in O(n3-δ’ log M) for some δ’>0.

Page 9: Minimum  Weight Cycle

Results (SODA'11)

• For undirected graphs with weights from [1,M]

a 4/3-approximation algorithm with a running time of

O(n² log n log nM).• For undirected graphs with real edge weights a

(4/3+ε)-approximation with a running time of Õ(1/ε n²).• An algorithm with (4/3-ε)-approximation can multiply two

Boolean matrices. (Using V.W & W ideas).

Page 10: Minimum  Weight Cycle

“A related problem is finding a minimum weighted circuit in a weighted graph. It is unclear to us whether our methods can be modified to answer this problem too.” SICOMP 1978

New Results

• For undirected and directed graphs with weights from [1,M] we show that the Min-Cycle problem can be efficiently reduced to finding a minimum weight triangle in graphs with weights [1,Θ(M)].

• This implies an Õ(Mnω) algorithm for Min-Cycle problem both in undirected and directed graphs.

We resolve the open problem raised by Itai & Rodeh:

Page 11: Minimum  Weight Cycle

New ResultsNotice!

APSP in directed graphs can be computed in

O(M0.681n2.575) time (Zwick JACM`02).

APSP in undirected graphs can be computed in

Õ(Mnω) time (Shoshan & Zwick FOCS`99).

We show that Min-Cycle in directed graphs can be

solved in Õ(Mnω) time!

Page 12: Minimum  Weight Cycle

In this talk

• For undirected graphs with weights from [1,M]

a 4/3-approximation algorithm with a running time of

O(n² log n log nM) (SODA’11)• For undirected graphs with weights from [1,M] we

show that the Min-Cycle problem can be efficiently reduced to finding a minimum weight triangle in graph with weights [1,Θ(M)]. (New result)

Page 13: Minimum  Weight Cycle

Itai & Rodeh’s Additive 1-Approximataions

0

1

2

3

x y z

The trivial algorithm: All edges of x are scanned in an arbitrary order. and in particular (x,y). A Min-Cycle is detected.

Running time: O(m). We repeat it from every vertex. Total running time is O(mn).

w

Unweighted undirected.

Page 14: Minimum  Weight Cycle

Itai & Rodeh’s Additive 1-Approximataions

0

1

2

3

x y z

Itai & Rodeh: Stop with the first cycle discovered. Running time O(n²).Assume x is out from the queue after z and before y.

w

Lucky scan (x,y) and stop.Output: Min-Cycle

Unlucky scan (x,w) and stop.Output: Min-Cycle+1

Unweighted undirected.

Page 15: Minimum  Weight Cycle

Lingas & Lundell 2-Approximataions

0

1

2

3

x y z

The same approach as IR with Dijkstra instead of BFS will not work.

Lingas & Lundell: Run Dijkstra with a bounding parameter t, that is, grow a shortest paths tree up to depth t and report the first cycle detected.

w

Weighted [1,M] undirected.

1

1

1

1

11

1

1

1

1100

Page 16: Minimum  Weight Cycle

Dijkstra(G,s)Q←{s}While Q is not empty do

u ← Extract-Min(Q)Relax(u)

Reminder: Dijkstra’s algorithm

Weighted [1,M] undirected.

Relax(u)foreach (u,v) E

if d[s,v]>d[s,u]+w(u,v) d[s,v] ← d[s,u]+w(u,v)

Page 17: Minimum  Weight Cycle

Bounded Dijkstra(G,s,t)Q←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,t)

Lingas & Lundell 2-Approximataion

Weighted [1,M] undirected.

Controlled-Relax(u,t)(u,v) ← Extract-Min(Qu)While d[u]+w(u,v) ≤ t do

RelaxOrStop(u,v)(u,v) ← Extract-Min(Qu)

RelaxOrStop(u,v)if d[v] then

Repot a cycle and stopelse

Relax(u,v)

s

u1 3

X1X2 X3

d[X1] = d[X2] =92

4

d[X3] =70

50

d[X1] = 51 STOP: Min-Cycle≤145

t=100

Page 18: Minimum  Weight Cycle

Lingas & Lundell 2-Approximataion

Weighted [1,M] undirected.

s

5050

50

5050

1

?

50

t=100

Bounded Dijkstra with t=100 might find the red cycle and not the blue one.

Page 19: Minimum  Weight Cycle

Lingas & Lundell 2-Approximataion

Weighted [1,M] undirected.

The algorithm: Binary search the interval [1,nM] for the smallest value of t for which Bounded Dijkstra reports a cycle.

t*=Min-Cycle

Always reports

½t*

May report

Taking the smallest value of t for which a cycle is reported ensures that t≤t* and a 2-approximation. Running time: O(n² log n (log n+log M))

Page 20: Minimum  Weight Cycle

Our 4/3-Approximataion

Weighted [1,M] undirected.

Let Min-Cycle=t* and Max-Edge(Min-Cycle)=w*. Let tt* . We present two algorithms:

Alg1: Reports a cycle of weight at most t* + w*.

Alg2: Given wl and wu such that w*[ wl , wu ] reports a cycle of weight at most max{2t* - 2wl , t* + wu - wl }.

Notice! max{2t* - 2wl , t* + wu - wl } is 2t* - 2wl as long as wu ≤ t* - wl

w*

Alg1

t* + w* ≤1⅓t*

w*

Alg2 [⅓t* , ⅔t*]2t* - 2w* ≤1⅓t*

t*

⅓t* ⅔t* w*

Alg2 [⅔t*, t*]t* + t*- ⅔t* ≤1⅓t*

Page 21: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Middle Edge Lemma: Let C={v1,v2,…vℓ} be a cycle of weight t and let sC. Then there exists an edge (vi,vi+1) such that:

s

vi vi+1

d[s,vi]≤½t

d[s,vi+1]≤½t

Page 22: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

For a given s there is a mid point in on the cycle

s

=t*/2

=t*/2

Page 23: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

s

t*/2= =t*/2

For a given s there is a mid point in on the cycle

Page 24: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

The edge (vi,vi+1) is the middle edge.

s

vi

vi+1

We have:

1. dC[s,vi]≤½t

2. dC[vi+1,s]≤½t

1. d[s,vi]≤½t

2. d[s,vi+1]≤½t

Page 25: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

And now, the algorithm!

Approx-Min-Cycle(G,s,t)R ←фQ←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,½t)Let (u,v) be the smallest edge of u that was not relaxedR←{(u,v)}

While R is not empty do(u,v) ← Extract-Min(R)RelaxOrStop(u,v)(u,v) ← Extract-Min(Qu)

R← R {(u,v)}

Phase 1

Phase 2

Page 26: Minimum  Weight Cycle

Approx-Min-Cycle(G,s,t)R ←фQ←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,½t)Let (u,v) be the smallest edge of u that was not relaxedR← R {(u,v)}

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Phase 1:

Bounded Dijkstra(G,s,t)Q←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,t)

s

½t

u0

v0 w

u1 u2

v1 v2

R = {(u0,v0) , (u1,v1) , (u2,v2) }R = {(u0,v0)}

Page 27: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Phase 2:

Approx-Min-Cycle(G,s,t)…While R is not empty do

(u,v) ← Extract-Min(R)RelaxOrStop(u,v)(u,v) ← Extract-Min(Qu)

R← R {(u,v)}s

½t

u0

v0 w

u1 u2

v1 v2

R = {(u0,v0) , (u1,v1) , (u2,v2) }

R = {(u0,v0) , (u1,v2) , (u2,v2) }

R = {(u0,v0) , (u1,v2) }

R = {(u0,v0)}

Page 28: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

We need to prove that:• We report a cycle of weight t*+w* (Weight bound).• The running time from a given vertex is Õ(n) (Running time).

A bound on the weight:

Approx-Min-Cycle(G,s,t)R ←фQ←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,½t) (1)R←{(u,v)}

Phase 1:

…While R is not empty do

(u,v) ← Extract-Min(R)RelaxOrStop(u,v) (2)(u,v) ← Extract-Min(Qu)R←{(u,v)}

Phase 2:

A cycle can be reported either in line (1) or (2). Easy case (line 1): We stopped in line (1). The weight of the reported cycle is at most t. Hard case (line 2): Next slide.

Page 29: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Hard case (line 2): If we stopped at phase 2 before the middle edge (vi,vi+1) of s gotout then any edge (x,y) that was popped out from R satisfies:

d[s,x]+w(x,y) ≤ min {d[s,vi]+w*,d[s,vi+1]+w*}

In particular, if we stopped with the edge (h,g) then:

d[s,h]+w(h,g)+d[s,g] ≤ 2 min {d[s,vi]+w*,d[s,vi+1]+w*} ≤ d[s,vi]+2w*+d[s,vi+1] ≤ t* +w*

s

vi vi+1

½t* ≤½t*

≤w*

s

h g Phase 1

Page 30: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Running time:

The first time that a vertex beyond the ½t threshold is added to R for the second time we stop and report a cycle. Hence, we can charge any edge of R to its endpoint beyond the ½t threshold and the running time is Õ(n).

R = {(u0,v0) , (u1,v1) , (u2,v2) }

s

½t

u0

v0 w

u1 u2

v1 v2

Page 31: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Summary:

• We have shown that given tt* in Õ(n²) time it is possible to return a cycle of weight t* + w*

• This algorithm is a natural generalization of the additive 1-approximation of Itai and Rodeh for unweighted graphs.

• Recall that this is just one ingredient of our algorithm.

Page 32: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg2 (max{2t* - 2wl , t* + wu - wl }).

Weighted [1,M] undirected.

Approx-Min-Cycle(G,s,t,wl,wu)d[s] = 0Controlled-Relax(s,wu)While Q is not empty do

u ← Extract-Min(Q) Controlled-Relax(u,t-wl)

Sketch:

Analysis: More complicated. Some intuition: when a cycle is reported it is because we reach some vertex u

twice. The bound is either 2t* - 2wl or t* + wu - wl.

s=vivi+1

=w*

w*[wl,wu]

Page 33: Minimum  Weight Cycle

In this talk

• For undirected graphs with weights from [1,M]

a 4/3-approximation algorithm with a running time of

O(n² log n log nM). (SODA’11)• For undirected graphs with weights from [1,M] we

show that the Min-Cycle problem can be efficiently reduced to finding a minimum weight triangle in graph with weights [1,Θ(M)]. (New result)

Page 34: Minimum  Weight Cycle

Weighted [1,M] undirected.

Theorem:

Given an undirected graph G with weights [1,M] there is an O(n² log n log nM) time algorithm that either find a Min-Cycle in G or compute log n graphs:

G’1 , G’2 ,G’3 , ... G’log n

With Θ(n) nodes and edge weights [1,O(M)] such that:The minimum weight triangle among all G’i graphs has the same weight as the Min-Cycle of G.

Min-Cycle to Min-Triangle

Page 35: Minimum  Weight Cycle

Simple (and important) observation:Assume that we run just the first phase of Alg1 (t*+w*) for a given t.

We either compute all distances of length at most ½t from s or report a cycle of weight at most t.

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

Approx-Min-Cycle(G,s,t)R ←фQ←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,½t)Let (u,v) be the smallest edge of u that was not relaxedR←{(u,v)}

While R is not empty do(u,v) ← Extract-Min(R)RelaxOrStop(u,v)(u,v) ← Extract-Min(Qu)R←{(u,v)}

Approx-Min-Cycle(G,s,t)Q←{s}While Q is not empty do

u ← Extract-Min(Q)Controlled-Relax(u,½t)

Page 36: Minimum  Weight Cycle

First stage:Binary search for the first t such that Approx-Min-Cycle(G,2t) does not report on a cycle and Approx-Min-Cycle(G,2t+2) reports.

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

t+1

Report a cycle ≤2t+2

t

No cycle is reported. All distances up to t are computed

Need to show: If the Min-Cycle ≤ 2t+1 we can find it.

Page 37: Minimum  Weight Cycle

vj

vi vi+1

Main Lemma:Let C={v1,v2, … ,vℓ} and assume that Approx-Min-Cycle(G,t) does not report a cycle then there are three distinct vertices vi,vi+1, and vjC such that:

dC[vj,vi]+w(vi,vi+1)>t and dC[vi+1,vj]+w(vi,vi+1)>t

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

≤ 2t+1

Page 38: Minimum  Weight Cycle

vj

vi vi+1

Main Lemma:Let C={v1,v2, … ,vℓ} and assume that Approx-Min-Cycle(G,t) does not report a cycle then there are three distinct vertices vi,vi+1, and vjC such that:

dC[vj,vi]+w(vi,vi+1)>t and dC[vi+1,vj]+w(vi,vi+1)>t

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

≤ 2t+1

dC[vj,vi] ≤ tdC[vi+1,vj] ≤ t

As this is a Min-Cycled[vj,vi] = dC[vj,vi] d [vi+1,vj]=dC[vi+1,vj]

and we have computed these distances !

Page 39: Minimum  Weight Cycle

Create a new graph G’:

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

vj

vi vi+1v2

i

v1j

v2i+1

(V1,ø)

(V2,E)

Distances

Page 40: Minimum  Weight Cycle

There are two problems with G’.• We may create a triangle that corresponds to a path rather than a cycle

• The weights in G’ may be Ω(nM) (not covered in the talk)

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

Page 41: Minimum  Weight Cycle

Fixing the first problem: The last vertex on the path to z is y. We use color coding (Alon, Yuster and Zwick JACM`95 ).We use two colors.

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

x1

y2 z2

y

(V1,ø)

(V2,E)

Distances

We add an edge (x1,z2) only if the last vertex before z is red y cannot be red and blue at the same time!

x

y

z

Page 42: Minimum  Weight Cycle

We avoid the bad case andremain with the good case

Weighted [1,M] undirected.

Min-Cycle to Min-Triangle

vj

vi vi+1

Page 43: Minimum  Weight Cycle

Summary

• We have settled many variants of a fundamental open problem in algorithmic graph theory.

• But, what about approximation in directed graphs? Can we get O(n3-δ) for some δ>0 and constant approximation? Or maybe we can show a “lower” bound.

Page 44: Minimum  Weight Cycle

Thank you!

Page 45: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Proof: Let (vi ,vi+1) be an edge of C with weight strictly more than ½t. In this case the claim holds for every vertex using this edge. Thus, we can assume that w*≤½t.

s=v1

vi vi+1

v2

v31. dC[s,vi]≤½t2. dC[s,vi+1]>½t

We search for two vertices that satisfy:

1. d[s,vi]≤dC[s,vi]≤½t2. d[s,vi+1]≤½t

Page 46: Minimum  Weight Cycle

Our 4/3-Approximataion: Alg1 (t* + w*)

Weighted [1,M] undirected.

Proof (cont): To complete the proof we need to show that these vertices exist. Assume on the contrary that we have not found two such vertices in the process.

s=v1

vi vi+1

v2

v3

This means that:

1. dC[s,vℓ-1] ≤ ½t2. dC[s,vℓ] ≤ ½t

A contradiction as w* ≤ ½t

vℓ

vℓ-1

> ½

t