1 / 22

Dynamic Single-source Shortest Paths

Dynamic Single-source Shortest Paths. Camil Demetrescu University of Rome “La Sapienza”. Let:. G = (V,E,w). weighted directed graph. w(u,v). weight of edge (u,v). source vertex. s  V. Perform intermixed sequence of operations:. Increase weight w(u,v) by . Increase(u,v,  ):.

kalona
Download Presentation

Dynamic Single-source Shortest Paths

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. Dynamic Single-source Shortest Paths Camil Demetrescu University of Rome “La Sapienza”

  2. Let: G = (V,E,w) weighted directed graph w(u,v) weight of edge (u,v) source vertex s  V Perform intermixed sequence of operations: Increase weight w(u,v) by  Increase(u,v,): Decrease weight w(u,v) by  Decrease(u,v,): Return distance (or sh. path)from s to v in G Query(v): Fully dynamic SSSP

  3. Ramalingam & Reps’ approach Maintain a shortest paths tree throughoutthe sequence of updates Querying a shortest paths or distance takesoptimal time Update operations work only on the portion oftree affected by the update Each update may take as long as a static SSSP computation in the worst case! Very efficient in practice

  4. Increase(u,v,e) s Shortest pathstree before the update u +e v T(s) T(v)

  5. Increase(u,v,e) s Shortest pathstree after the update u +e v + w T'(s) T'(v)

  6. Graph G s Subgraph induced by vertices in T(v) Ramalingam & Reps’ approach Perform SSSP only on the subgraph and source s s u +e v

  7. Exercise 1 Let G=(V,E,w) be a weighted directed graph, let s be a source vertex, and let T be a shortest path tree of G rooted at s. Let A be the set of vertices in the subtree of T rooted at v. Prove that no edge from A to V-A can become part of T as a result of an increase(u,v,e) operation that increases the weight of edge (u,v) by positive amount e.

  8. Non-negative vs. negative edge weights Non-negative edge weights:No dynamic algorithm better than rebuilding from scratch (in the worst case)  Main open problem! Arbitrary edge weights:Best static algorithm as high as O(m√n log M), O(mn) in general Dynamic algorithms instead much faster than rebuilding from scratch: update operations in the same bounds as static computations with non-negative weights (e.g., O(m+n log n) using Dijkstra)

  9. G = (V,E,w) w : E   Reweighting h : V   (potential func.) Gh= (V,E,wh) wh(u,v) = w(u,v) + h(u) - h(v) Nice fact: P is a shortest path in G P is a shortest path in Gh Graph reweighting using reduced weights

  10. If we choose: h(v) := d(v) = distance from s to v in G Claim: wd(u,v) = w(u,v) + d(u) - d(v) ≥ 0 Proof: d(v) ≤ w(u,v) + d(u) [Bellman cond.] Getting non-negative reduced weights 0 ≤ w(u,v) + d(u) - d(v) = wd(u,v)

  11. Proof: P = <s, v1, v2, …, vk, v> = shortest path from s to v w(P) + d(s) - d(v) = w(P) + 0 - w(P) = 0 A cute property of Gd Claim: For any v, the distance dd(v) from s to v in Gd is zero: dd(v) = wd(P) = wd(s,v1) + … + wd(vk,v) = w(s,v1) +…+ w(vk,v) + d(s) - d(v1) + d(v1) - d(v2) +…=

  12. increase(: E  +)  = any non-neg. function Update G by letting: w  w +  2. Build Gd ( wd is obviously non-negative ) An increase algorithm Maintain G and d subject to the operation: O(m) O(m) 3. Compute for each v its distance dd(v) from s in Gd e.g., O(m+ n log n) 4. For each v, update d(v)  d(v) + dd(v) O(n) Exercise 2: prove that d(v)’s are correctly updated

  13. s Gd decrease(u, v, ) wd(u,v) u Update G by letting: w(u,v)  w(u,v) -  v s G - u v A decrease algorithm O(1) 2. Build Gd, then remove (u,v) from it andadd (s,v) with wd(s,v)  wd(u,v) O(m) 3. Compute for each v its distance dd(v) from s in Gd O(?) 4. For each v, update d(v)  d(v) + dd(v) O(n)

  14. Exercises Exercise 3: how fast can step 3 be implemented? Exercise 4: how can we detect negative cycles? Exercise 5: prove that d(v)’s are correctly updated Exercise 6: can we extend this to decrease (1) edgesat the same time within the same time bounds? Would that be a breakthrough result?

  15. O(m·n) O(m+n·log n) Theory and practice In theory, for arbitrary edge weights, we can do much better than rebuilding from scratch In practice, can we get fast codes? Two tricks: • Only work for vertices affected by the update • (Ramalingam-Reps’ approach) • Avoid to build Gd explicitly

  16. A fast implem. (RRL)[Dem.’01] Exercise 7: write decrease(u,v,) increase(u,v,) w(u,v)  w(u,v) +  if (u,v) T(v) then return let H be a priority queue add x  T(v) to H with priority: p(x) = min(z,x):z  T(v) d(z) + w(z,x) - d(x) while (H ≠ ) x  extract min priority vertex from H d(x)  d(x) + p(x) for each (x,y) if d(x) + w(x,y) - d(y) < p(y) then p(y)  d(x) + w(x,y) - d(y)

  17. Experimental platform: - C++ using LEDA, g++ compiler - UNIX Solaris on SPARC Ultra 10 at 300 Mhz Test sets: - Random graphs & random update sequences (we used potentials technique to avoid negative cycles) Performance indicators: - Running time (msec) - Number of updated vertices per operation Experimental setup

  18. Static vs. dynamic

  19. If shortest paths are not unique, not all the vertices in T(v) may actually change distance + Can we do any better? Output-bounded cost model (Ramalingam-Reps): an optimal algorithm should spend time proportional to actual change in output solution due to update operation (e.g., changes in the shortest paths tree) Ramalingam & Reps (and later Frigioni et al.)have devised algorithms in this model for dynamic SSSP

  20. Static vs. dynamic

  21. + Number of updated vertices

  22. Further readings Ramalingam & Reps’ approach + RR algorithm:[Ramalingam-Reps’96]G. Ramalingam, Thomas W. Reps: An Incremental Algorithm for a Generalization of the Shortest-Path Problem. J. Algorithms 21(2): 267-305 (1996) RRL algorithm + experiments:[Demetrescu’01]C. Demetrescu, Fully Dynamic Algorithms for Path Problems on Directed Graphs, Ph.D. Dissertation, University of Rome “La Sapienza”, April 2001 Other computational study (not covered in this lecture):Luciana S. Buriol, Mauricio G. C. Resende and Mikkel Thorup, Speeding up dynamic shortest pathshttp://citeseer.ist.psu.edu/689842.html

More Related