Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Top-k shortest path

5,673 views

Published on

cikm 2009: top k shortest paths

Published in: Technology
  • Be the first to comment

Top-k shortest path

  1. 1. Fast Top-k Simple Shortest Paths Discovery in Graphs Database Research Group Department of Computer Science Peking University Jun Gao, Huida Qiu, Xiao Jiang, Dongqing Yang, Tenjiao Wang
  2. 2. <ul><li>Motivation </li></ul><ul><li>Related Work </li></ul><ul><li>Our Method </li></ul><ul><li>Experiments </li></ul><ul><li>Conclusion </li></ul>Outline
  3. 3. Motivation <ul><li>From “Finding the k Shortest Paths ” by David Eppstein </li></ul><ul><ul><li>Additional constraints </li></ul></ul><ul><ul><li>Model evaluation </li></ul></ul><ul><ul><li>Sensitivity analysis </li></ul></ul><ul><ul><li>Generation of alternatives </li></ul></ul><ul><li>When the shortest path is not sufficient for application, top-k shortest paths are desired. </li></ul>
  4. 4. Top k shortest paths query <ul><li>Top 2 general shortest path </li></ul><ul><li>(allowing loops) : </li></ul><ul><ul><li>1 st : 1  2  3  4, length: 3 </li></ul></ul><ul><ul><li>2 nd : 1  2  3  6  2  3  4, length: 6 </li></ul></ul>1 1 1 1 1 3 3 1 2 3 4 5 6 <ul><li>Top 2 simple shortest path </li></ul><ul><li>(without loops) : </li></ul><ul><ul><li>1 st : 1  2  3  4, length: 3 </li></ul></ul><ul><ul><li>2 nd : 1  2  5  3  4, length: 8 </li></ul></ul>1
  5. 5. <ul><li>Motivation </li></ul><ul><li>Related work </li></ul><ul><li>Our method </li></ul><ul><li>Experiments </li></ul><ul><li>Conclusion </li></ul>Outline
  6. 6. Top K genenal shortest path problem <ul><li>Related work </li></ul><ul><ul><li>David Eppstein. Finding the k shortest paths. SIAM J. Comput. (SIAMCOMP), 28(2):652–673, 1998 </li></ul></ul><ul><li>Basic Idea </li></ul><ul><li>Time Complexity </li></ul><ul><ul><li>O(m+nlogn+k) </li></ul></ul>Original Graph Shortest Path Tree Side Cost on Edges
  7. 7. Top K loopless Shortest Path Problem <ul><li>Related work </li></ul><ul><ul><li>J. Y. YEN. Finding the k shortest loopless paths in a network. Manage. Sci, 17(712-716), 1971. </li></ul></ul><ul><ul><li>Basic Idea </li></ul></ul><ul><ul><li>Find the shortest path first </li></ul></ul><ul><ul><li>2-th shortest path should be </li></ul></ul><ul><ul><ul><li>different from the shortest path </li></ul></ul></ul><ul><ul><ul><li>loopless </li></ul></ul></ul><ul><ul><ul><li>shortest in the remaining paths </li></ul></ul></ul><ul><ul><li>Find the next shortest paths iteratively </li></ul></ul><ul><li>Time Complexity </li></ul><ul><ul><li>O(kn(m+nlogn)) </li></ul></ul>Candidate Paths
  8. 8. Top K loopless Shortest Path Problem <ul><li>Related work </li></ul><ul><ul><li>J. Hershberger, S. Suri, and A. Bhosle. On the difficulty of some shortest path problems. ACM Transactions on Algorithms, 3(1), 2007 </li></ul></ul><ul><li>Basic Idea </li></ul><ul><ul><li>Remove edge to find next shortest path </li></ul></ul><ul><ul><li>Use the intermediate result to lower the cost </li></ul></ul><ul><li>Time Complexity </li></ul><ul><ul><li>O(k(m+nlogn)) </li></ul></ul><ul><ul><li>Loop in some cases </li></ul></ul>Candidate Paths
  9. 9. <ul><li>Motivation </li></ul><ul><li>Related work </li></ul><ul><li>Our method </li></ul><ul><li>Experiments </li></ul><ul><li>Conclusion </li></ul>Outline
  10. 10. Basic Idea <ul><li>The key operation is to reduce the redundant computation cost for the same target node. </li></ul><ul><li>We pre-compute the shortest path tree rooted at the target node </li></ul><ul><li>We expect the candidate path searching can be terminated early with the shortest path tree </li></ul><ul><li>The final path is the concatenation of 3 sub-paths, the first sub-path is in the current shortest path, the second one is discovered online, the third on is in the shortest path tree. </li></ul><ul><ul><li>The existing method need discover the second and third sub-path online. </li></ul></ul>
  11. 11. Graph Pre-processing Precompute the shortest path tree rooted at t Make side cost of each edge Assign (pre, post, parent) encoding on each node to accelarate the loop detection
  12. 12. Searching for the candidate paths <ul><li>On the transformed graph, we start searching with the side cost </li></ul><ul><li>The path with the minimal side cost equals the path with the cost in the original graph </li></ul><ul><li>In the seaching, the loop needs be detected. </li></ul><ul><li>When no loop can be found, the path can be discovered directly </li></ul>Starting Node
  13. 13. Path Searching Example <ul><li>The edge e to g cannot be considered </li></ul><ul><li>d is then considered. But e is the ancestor of d </li></ul><ul><li>c is then considered, but e is the ancestor of c </li></ul><ul><li>f is then considered, f to t is not via node s b e </li></ul>
  14. 14. Optimization-1 <ul><li>k-reduction strategy : stop when </li></ul><ul><ul><li>k 1 shortest paths discovered; </li></ul></ul><ul><ul><li>k 2 paths in candidate pool have the same length as the k 1 -th shortest path; </li></ul></ul><ul><ul><li>k 1 + k 2 ≥ k </li></ul></ul>
  15. 15. Optimization-2 <ul><li>Suppose we know the length of the shortest path is l 1 , the length of the k-th shortest path is l 2 ; </li></ul><ul><li>Let th = l 2 – l 1 ; </li></ul><ul><li>When looking for paths from deviation nodes, we can stop searching when the current accumulated side cost already exceeds th ; </li></ul>
  16. 16. Optimization-2 <ul><li>Approximate threshold: the shortest path is needed; any other k-1 paths will do. </li></ul><ul><ul><li>Eager policy: search for k-1 candidate paths instead of one from the first deviation node; </li></ul></ul><ul><ul><li>Lazy policy: determine after there are k-1 paths in the candidate pool. </li></ul></ul><ul><ul><li>As more paths are discovered, the threshold can be adaptively updated and slowly becomes tighter. </li></ul></ul>
  17. 17. <ul><li>Motivation </li></ul><ul><li>Related work </li></ul><ul><li>Our method </li></ul><ul><li>Experiments </li></ul><ul><li>Conclusion </li></ul>Outline
  18. 18. Experimental Evaluation <ul><li>Comparison algorithms: </li></ul><ul><ul><li>YEN : Yen’s classic algorithm; </li></ul></ul><ul><ul><li>JH : the edge-replacement based method by John Hershberger et al. </li></ul></ul><ul><ul><li>Implementation: C++, by Hershberger et al. </li></ul></ul><ul><li>Our method: all implemented in Java </li></ul><ul><ul><li>KR: the base method with k-reduction; </li></ul></ul><ul><ul><li>KRE: k-reduction plus Eager policy; </li></ul></ul><ul><ul><li>KRL: k-reduction plus Lazy policy; </li></ul></ul>
  19. 19. Datasets <ul><li>Real datasets: (Density = # of Edges / # of nodes) </li></ul><ul><li>Synthetic datasets: </li></ul><ul><ul><li>Random graphs generated by Barabasi Graph Generator (by Derek Dreier, available from Internet) </li></ul></ul>Dataset # of Nodes # of Edges Density Add32 4,960 9,462 1.91 Crack 10,240 30,380 2.97 Gupta3 16,783 4,670,105 278.26 FLA 1,070,376 2,712,798 2.53
  20. 20. Impact of Graph Size <ul><li>Density = 3, # of nodes from 10k to 100k; </li></ul>
  21. 21. Impact of k <ul><li>Performed on real graphs. </li></ul>
  22. 22. Impact of Density <ul><li>k=1000 </li></ul>
  23. 23. <ul><li>Motivation </li></ul><ul><li>Related Work </li></ul><ul><li>Our Method </li></ul><ul><li>Experiments </li></ul><ul><li>Conclusion </li></ul>Outline
  24. 24. Conclusion <ul><li>We speed up top-k shortest path discovery. </li></ul><ul><ul><li>Combine Yen’s and Eppstein’s idea </li></ul></ul><ul><ul><li>Transform the candidate path discovery to the side cost graph </li></ul></ul><ul><ul><ul><li>Terminate Earlier </li></ul></ul></ul><ul><ul><li>Use structural labels to detect the loop effectively. </li></ul></ul><ul><ul><li>Introduce two other optimizations </li></ul></ul><ul><ul><ul><li>Reduce number of k </li></ul></ul></ul><ul><ul><ul><li>Avoid the worst case of path searching. </li></ul></ul></ul>
  25. 25. Future work <ul><li>Extend the top k shortest path between two node to two node sets </li></ul><ul><li>Find top-k shortest path core </li></ul><ul><li>Find approximate top-k shortest path </li></ul>
  26. 26. Thanks for your attention! <ul><li>[email_address] </li></ul>

×