1 / 46

Minimum Weight Cycle

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.

norm
Download Presentation

Minimum Weight Cycle

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Minimum WeightCycle 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)

  2. Problem Definition Given 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)

  3. v u The Trivial Algorithm • Directed graphs: • Compute All-Pairs of Shortest Paths (APSP). • Min-Cycle = min(u,v)Ed[v,u] + w(u,v)

  4. The Trivial Algorithm • Undirected graphs: • Dijkstra/BFS from every vertex of the graph • Pick the minimum cycle detected Example (unweighted): v u s In both cases the running time is Õ(n³).

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

  6. Previous Work (2) Yuster & Zwick (SIDMA 1997) presented an algorithm that finds the shortest even cycle in unweighted undirected graphs in O(n²) time.

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

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

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

  10. New Results “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 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:

  11. New Results Notice! 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!

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

  13. Unweighted undirected. Itai & Rodeh’s Additive 1-Approximataion s 0 1 x y z 2 w 3 The trivial algorithm: Alledges 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).

  14. Itai & Rodeh’s Additive 1-Approximataion Unweighted undirected. s 0 1 x y z 2 w 3 Itai & Rodeh: Stop with the first cycle discovered. Running time O(n²). Assume xis out from the queue after z and before y. Lucky scan (x,y) and stop. Output: Min-Cycle Unlucky scan (x,w) and stop. Output: Min-Cycle+1

  15. Lingas & Lundell 2-Approximataion Weighted [1,M] undirected. s 0 1 1 1 1 1 1 1 1 1 x y z 2 100 1 1 w 3 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.

  16. Weighted [1,M] undirected. Reminder: Dijkstra’s algorithm • Dijkstra(G,s) • Q←{s} • While Q is not empty do u ← Extract-Min(Q) Relax(u) • 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)

  17. Weighted [1,M] undirected. Lingas & Lundell 2-Approximataion • Bounded Dijkstra(G,s,t) • Q←{s} • While Q is not empty do u ← Extract-Min(Q) Controlled-Relax(u,t) • 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) s • RelaxOrStop(u,v) • if d[v]   then Repot a cycle and stop else Relax(u,v) 50 t=100 u 4 1 3 X2 X3 X1 d[X3] =70 d[X2] =92 d[X1] =  STOP: Min-Cycle≤145 d[X1] = 51

  18. Weighted [1,M] undirected. Lingas & Lundell 2-Approximataion ? s t=100 50 50 50 50 1 50 50 Bounded Dijkstra with t=100 might find the red cycle and not the blue one.

  19. Weighted [1,M] undirected. May report ½t* Lingas & Lundell 2-Approximataion The algorithm: Binary search the interval [1,nM] for the smallest value of t for which Bounded Dijkstra reports a cycle. Always reports t*=Min-Cycle 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))

  20. Weighted [1,M] undirected. ⅓t* ⅔t* t* Our 4/3-Approximataion • Let Min-Cycle=t* and Max-Edge(Min-Cycle)=w*. Let tt* . • We present two algorithms: • Alg1: Reports a cycle of weight at most t* + w*. • Alg2: Given wl and wusuch 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* w* w* Alg1 t* + w*≤1⅓t* Alg2[⅓t* , ⅔t*] 2t* - 2w*≤1⅓t* Alg2[⅔t*, t*] t* + t*- ⅔t*≤1⅓t*

  21. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) MiddleEdgeLemma: Let C={v1,v2,…vℓ} be a cycle of weight t and let sC. Then there exists an edge (vi,vi+1) such that: s d[s,vi]≤½t d[s,vi+1]≤½t vi vi+1

  22. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) For a given s there is a mid point in on the cycle s =t*/2 =t*/2

  23. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) For a given s there is a mid point in on the cycle s =t*/2 t*/2=

  24. Weighted [1,M] undirected. We have: 1. dC[s,vi]≤½t 2. dC[vi+1,s]≤½t 1. d[s,vi]≤½t 2. d[s,vi+1]≤½t Our 4/3-Approximataion: Alg1 (t* + w*) The edge (vi,vi+1) is the middle edge. s vi+1 vi

  25. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) 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 relaxed • R←{(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

  26. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) Phase 1: • 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 relaxed • R← R  {(u,v)} • … s • Bounded Dijkstra(G,s,t) • Q←{s} • While Q is not empty do u ← Extract-Min(Q) Controlled-Relax(u,t) R = {(u0,v0)} R = {(u0,v0) , (u1,v1) , (u2,v2) } u0 u1 u2 ½t v0 w v1 v2

  27. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) 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)} R = {(u0,v0) , (u1,v1) , (u2,v2) } R = {(u0,v0) , (u1,v2) , (u2,v2) } R = {(u0,v0) , (u1,v2) } R = {(u0,v0)} s u0 u1 u2 ½t v0 w v1 v2

  28. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) • 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: Phase 1: Phase 2: • … • While R is not empty do (u,v) ← Extract-Min(R) RelaxOrStop(u,v) (2) (u,v) ← Extract-Min(Qu) • R←{(u,v)} • 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)} 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.

  29. Weighted [1,M] undirected. Phase 1 Our 4/3-Approximataion: Alg1 (t* + w*) Hard case (line 2): If we stopped at phase 2 before the middle edge (vi,vi+1) of s got out 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 s ½t* ≤½t* g h ≤w* vi vi+1

  30. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) 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 u0 u1 u2 ½t v0 w v1 v2

  31. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg1 (t* + w*) • Summary: • We have shown that given tt* 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.

  32. Weighted [1,M] undirected. Our 4/3-Approximataion: Alg2(max{2t* - 2wl , t* + wu - 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. • Approx-Min-Cycle(G,s,t,wl,wu) • d[s] = 0 • Controlled-Relax(s,wu) • While Q is not empty do u ← Extract-Min(Q) Controlled-Relax(u,t-wl) =w* vi+1 s=vi w*[wl,wu]

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

  34. Weighted [1,M] undirected. Min-Cycle to Min-Triangle 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’igraphs has the same weight as the Min-Cycle of G.

  35. Weighted [1,M] undirected. Min-Cycle to Min-Triangle 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. • 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 relaxed • R←{(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)

  36. Weighted [1,M] undirected. Min-Cycle to Min-Triangle 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. Report a cycle ≤2t+2 t t+1 No cycle is reported. All distances up to t are computed Need to show: If the Min-Cycle ≤ 2t+1 we can find it.

  37. Weighted [1,M] undirected. vj Min-Cycle to Min-Triangle 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 vjC such that: dC[vj,vi]+w(vi,vi+1)>t and dC[vi+1,vj]+w(vi,vi+1)>t ≤ 2t+1

  38. Weighted [1,M] undirected. Min-Cycle to Min-Triangle 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 vjC such that: dC[vj,vi]+w(vi,vi+1)>t and dC[vi+1,vj]+w(vi,vi+1)>t vj dC[vj,vi] ≤ t dC[vi+1,vj] ≤ t and we have computed these distances ! As this is a Min-Cycle d[vj,vi] = dC[vj,vi] d[vi+1,vj]=dC[vi+1,vj] ≤ 2t+1 vi vi+1

  39. Weighted [1,M] undirected. v1j v2i+1 Min-Cycle to Min-Triangle Create a new graph G’: (V1,ø) Distances (V2,E) vj v2i vi vi+1

  40. Weighted [1,M] undirected. Min-Cycle to Min-Triangle 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)

  41. Weighted [1,M] undirected. x1 y y2 z2 Min-Cycle to Min-Triangle 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. x (V1,ø) Distances (V2,E) y z 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!

  42. Weighted [1,M] undirected. Min-Cycle to Min-Triangle We avoid the bad case and remain with the good case vj vi vi+1

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

  44. Thank you!

  45. Weighted [1,M] undirected. We search for two vertices that satisfy: 1. dC[s,vi]≤½t 2. dC[s,vi+1]>½t 1. d[s,vi]≤dC[s,vi]≤½t 2. d[s,vi+1]≤½t Our 4/3-Approximataion: Alg1 (t* + w*) 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 v2 v3 vi vi+1

  46. Weighted [1,M] undirected. 1. dC[s,vℓ-1] ≤ ½t 2. dC[s,vℓ] ≤ ½t A contradiction as w* ≤ ½t Our 4/3-Approximataion: Alg1 (t* + w*) 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. > ½t s=v1 This means that: v2 vℓ v3 vℓ-1 vi vi+1

More Related