1 / 20

All-Pairs Shortest Paths & Essential Subgraph

All-Pairs Shortest Paths & Essential Subgraph. 01/25/2005 Jinil Han. Problem Description. Finding shortest paths between all pairs of vertices in a directed graph G=(V,E) with nonnegative edge weights n=|V|, m=|E|. Well-known Algorithms. Dijkstra ’ s algorithm

lot
Download Presentation

All-Pairs Shortest Paths & Essential Subgraph

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. All-Pairs Shortest Paths & Essential Subgraph 01/25/2005 Jinil Han

  2. Problem Description • Finding shortest paths between all pairs of vertices in a directed graph G=(V,E) with nonnegative edge weights n=|V|, m=|E|

  3. Well-known Algorithms • Dijkstra’s algorithm running a single-source shortest paths algorithm |V| times O(n2lgn + nm), when implementing priority queue with a Fibonacci heap when all edge weights are nonnegative ** Fibonacci heap delete-min : O(lgn) priority change : O(1)

  4. Well-known Algorithms • Bellman-Ford algorithm dj(m+1) = min {dj(m), min {dk(m), +akj}} O(n2m), O(n4) if graph is dense negative edges are allowed • Floyd-Warshall algorithm dij(k) = min {dij(k-1) , dik(k-1) + dkj(k-1)} O(n3) negative edges are allowed Now, introduce two algorithms with running time of O(n2lgn+ns)

  5. Algorithm Outline • Run Dijkstra’s single source algorithm in parallel for all points in the graph • Discover the hidden “shortest path structure” (essential subgraph H) • Running time is equivalent to solving n single-source shortest path problems using only the edges in H O(n2lgn + ns), s = the number of edges in H • s is likely to be small in practice, for general random graph, s = O(nlgn) almost surely  expected running time is O(n2lgn)

  6. Hidden Paths Algorithm • Maintains a heap containing for each ordered pair of vertices u, v the best path from u to v found so far • At each iteration, removes a path (u~v), from top of the heap (this is the optimal path from u to v) • This path is now used to construct a set of new candidate paths • If a new candidate path (w~t) is shorter, it replaces the current best path from w to t in the heap • This maintains the optimality of the path at the top of the heap

  7. Hidden Paths Algorithm

  8. Hidden Paths Algorithm

  9. Hidden Paths Algorithm • Example

  10. Hidden Paths Algorithm • Running time analysis 1. the initialization step : a heap of size O(n2) 2. Step 1 & Step 2 : at most n(n-1) times  at most n(n-1) delete-min operations 3. the only candidate paths created are those of the form (u,v~w) where both (u,v) and (v~w) are optimal  The total number of candidate paths created is O(sn)  At most one priority change operation associated with each candidate path

  11. Hidden Path Algorithm • Running time analysis

  12. SHORT Algorithm • Rather than iterating over nodes to solve n SSP problems, the algorithm iterates over edges and solves the SSP problem incrementally ( same as hidden Path algorithm) • It is efficient because each distance need only be computed once • The two algorithms would discover and report distances in different order • The n shortest-path trees are constructed as a by-product of SHORT but not of Hidden Path algorithm

  13. SHORT Algorithm • Essential subgraph contain an edge (x,y) in E whenever d(x,y) =c(x,y) and there is no alternate path of equivalent cost, that is, edge (x,y) is in H when it is uniquely the shortest path in G between x and y H G

  14. SHORT Algorithm • Think of SHORT as an algorithm for constructing H • SHORT builds H correctly (refer to a paper for proof)

  15. SHORT Algorithm • The Search Procedure returns a decision accept or reject depending on whether an alternate path exists in the partially built subgraph Hi construct n single-source trees incrementally ** review of Dijkstra’s algorithm A shortest path tree T(v) rooted at v is built maintain a heap of fringe vertices which are not in T(v) but are adjacent to vertices in T(v) vertices are extracted from the fringe heap and added to T(v) Dijkstra-Process(v,x,y) operates on edge (x,y) when vertex x is added to T(v)

  16. SHORT Algorithm • The Search Procedure

  17. SHORT Algorithm • Example

  18. SHORT Algorithm • Running time analysis for each vertex, Dijkstra-Process processes each edge of H exactly once at most n inserts, deletes, and s decrease-key operations on the fringe heap  O(s + nlgn) using Fibonacci heaps  The total cost is therefore O(n2lgn + ns)

  19. s in a Random graph • To predict behavior of algorithms in practice for a large class of probability distributions on random graph, s= O(nlgn) consider dist. F on nonnegative edge weights, which doesn’t depend on n, such that F’(0) > 0 (Ex. Uniform and exponential) Th. Let G be complete directed graph, whose edge weights are chosen independently according to F. Then with probability 1-O(n-1), the diameter of G is O(lgn/n), and hence s = O(nlgn)  with high probability the running time of the algorithms are O(n2lgn)

  20. Essential Subgraph • The essential subgraph is unique and that for every pair of vertices there is a shortest path between them comprising only edges in H  H is the optimal subgraph for distance computations on G • H is exactly the union of n SSP trees and H must contain a minimum spanning tree of G

More Related