Skip to main content

Average-Case Behavior of k-Shortest Path Algorithms

  • Conference paper
  • First Online:
Complex Networks and Their Applications VII (COMPLEX NETWORKS 2018)

Part of the book series: Studies in Computational Intelligence ((SCI,volume 812))

Included in the following conference series:

Abstract

The k-shortest path problem is a generalization of the fundamental shortest path problem, where the goal is to compute k simple paths from a given source to a target node, in non-decreasing order of their weight. With numerous applications modeling various optimization problems and as a feature in some learning systems, there is a need for efficient algorithms for this problem. Unfortunately, despite many decades of research, the best directed graph algorithm still has a worst-case asymptotic complexity of \(\tilde{O}(k\, n (n+m))\). In contrast to the worst-case complexity, many algorithms have been shown to perform well on small diameter directed graphs in practice. In this paper, we prove that the average-case complexity of the popular Yen’s algorithm on directed random graphs with edge probability \(p = \varOmega (\log {n})/n\) in the unweighted and uniformly distributed weight setting is \(O(k\, m \log {n})\), thus explaining the gap between the worst-case complexity and observed empirical performance. While we also provide a weaker bound of \(O(k\, m \log ^4{n})\) for sparser graphs with \(p \ge 4/n\), we show empirical evidence that the stronger bound should also hold in the sparser setting. We then prove that Feng’s directed k-shortest path algorithm computes the second shortest path in expected O(m) time on random graphs with edge probability \(p = \varOmega (\log {n})/n\). Empirical evidence suggests that the average-case result for the Feng’s algorithm holds even for \(k>2\) and sparser graphs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 169.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 219.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    In fact, Priebe showed (P1) in the form of his Lemma 3.4 and (P2) in the form of his Lemma 3.10, for any edge weight distribution function F that satisfies the following requirements: F is concentrated on \([0,\infty )\), \(F(0) = 0\) and that \(F'(0)\) exists and is strictly positive. Since the uniform edge weight distribution between 0 and 1 is compatible with these requirements, (P1) and (P2) hold for \(\mathcal{D}(n,p,[0,1])\), too.

  2. 2.

    For \(p\ge 4/n\) the size of the giant strong component is \(\varOmega (n)\) w.h.p. [20].

  3. 3.

    We are aware that there exist improved SSSP algorithms with linear average-case time (e.g., [16, 26]) for initially uniformly distributed edge weights. Unfortunately, for the particular subgraphs on which we would like to apply these better SSSP algorithms it seems difficult to prove that their overall edge weight distribution remains sufficiently uniform

  4. 4.

    We note that for convex properties, the G(np) and G(nm) random graph models are equivalent up to lower order terms, provided \(m \approx p \cdot N\) (where N is the maximum number of edges insertable in a graph, \(N=n(n-1)\) for directed graphs) [7]. Thus, the empirical results shown for the G(nm) model should also hold for the G(np) model.

References

  1. Agarwal, U., Ramachandran, V.: Finding \(k\) simple shortest paths and cycles. In: Proceedings of the 27th ISAAC, LIPIcs, pp. 8:1–8:12 (2016)

    Google Scholar 

  2. Agarwal, U., Ramachandran, V.: Fine-grained complexity for sparse graphs. Proceedings of the 50th STOC, pp. 239–252. ACM (2018)

    Google Scholar 

  3. Ajwani, D., Duriakova, E., Hurley, N., Meyer, U., Schickedanz, A.: An empirical comparison of \(k\)-shortest simple path algorithms on multicores. In: Proceedings of the 47th ICPP (2018)

    Google Scholar 

  4. Akiba, T., Hayashi, T., Nori, N., Iwata, Y., Yoshida, Y.: Efficient top-k shortest-path distance queries on large networks by pruned landmark labeling. Proceedings of the 29th AAAI, pp. 2–8 (2015)

    Google Scholar 

  5. Bernstein, A.: A nearly optimal algorithm for approximating replacement paths and k shortest simple paths in general graphs. In: Proceedings of the 21st SODA, pp. 742–755 (2010)

    Google Scholar 

  6. Bernstein, A., Karger, D.R.: A nearly optimal oracle for avoiding failed vertices and edges. In: Proceedings of the 41st STOC, pp. 101–110 (2009)

    Google Scholar 

  7. Bollobás, B.: Models of Random Graphs. Cambridge Studies in Advanced Mathematics, 2nd edn, pp. 34–59. Cambridge University Press, Cambridge (2001)

    Google Scholar 

  8. Chung, F., Lu, L.: The diameter of sparse random graphs. Adv. Appl. Math. 26(4), 257–279 (2001). https://doi.org/10.1006/aama.2001.0720

    Google Scholar 

  9. Clarke, S., Krikorian, A., Rausen, J.: Computing the N best loopless paths in a network. J. Soc. Ind. Appl. Math. 11(4), 1096–1102 (1963)

    Google Scholar 

  10. Demetrescu, C., Thorup, M., Chowdhury, R.A., Ramachandran, V.: Oracles for distances avoiding a failed node or link. SIAM J. Comput. 37(5), 1299–1318 (2008)

    Google Scholar 

  11. Dijkstra, E.W.: A note on two problems in connexion with graphs. Numer. Math. 1(1), 269–271 (1959)

    Google Scholar 

  12. Eppstein, D.: Finding the \(k\) shortest paths. SIAM J. Comput. 28(2), 652–673 (1998)

    Google Scholar 

  13. Feng, G.: Finding k shortest simple paths in directed graphs: a node classification algorithm. Networks 64(1), 6–17 (2014)

    Google Scholar 

  14. Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM (JACM) 34(3), 596–615 (1987)

    Google Scholar 

  15. Frieder, A., Roditty, L.: An experimental study on approximating \(k\) shortest simple paths. J. Exp. Algorithmics (JEA) 19, 1–5 (2015)

    Google Scholar 

  16. Goldberg, A.V.: A practical shortest path algorithm with linear expected time. SIAM J. Comput. 37(5), 1637–1655 (2008)

    Google Scholar 

  17. Gotthilf, Z., Lewenstein, M.: Improved algorithms for the k simple shortest paths and the replacement paths problems. Inf. Process. Lett. 109(7), 352–355 (2009)

    Google Scholar 

  18. Graham, A.J., Pike, D.A.: A note on thresholds and connectivity in random directed graphs. Atl. Electron. J. Math. 3(1), 1–5 (2008)

    Google Scholar 

  19. Hershberger, J., Maxel, M., Suri, S.: Finding the k shortest simple paths: a new algorithm and its implementation. ACM Trans. Algorithms (TALG) 3(4), 45 (2007)

    Google Scholar 

  20. Karp, R.M.: The transitive closure of a random digraph. Random Struct. Algorithms 1(1), 73–94 (1990)

    Google Scholar 

  21. Katoh, N., Ibaraki, T., Mine, H.: An efficient algorithm for k shortest simple paths. Networks 12(4), 411–427 (1982)

    Google Scholar 

  22. Kurz, D., Mutzel, P.: A sidetrack-based algorithm for finding the k shortest simple paths in a directed graph. CoRR/arXiv:abs/1601.02867 (2016)

    Google Scholar 

  23. Lawler, E.L.: A procedure for computing the k best solutions to discrete optimization problems and its application to the shortest path problem. Manag. Sci. 18(7), 401–405 (1972)

    Google Scholar 

  24. Martins, E., Pascoal, M.M., Santos, J.: Deviation algorithms for ranking shortest paths. Int. J. Found. Comput. Sci. 10(3), 247–262 (1999)

    Google Scholar 

  25. Martins, E.Q., Pascoal, M.M.: A new implementation of Yens ranking loopless paths algorithm. J. Belg. Fr. Ital. Oper. Res. Soc. 1(2), 121–133 (2003)

    Google Scholar 

  26. Meyer, U.: Average-case complexity of single-source shortest-paths algorithms: lower and upper bounds. J. Algorithms 48(1), 91–134 (2003)

    Google Scholar 

  27. Perko, A.: Implementation of algorithms for k shortest loopless paths. Networks 16(2), 149–160 (1986)

    Google Scholar 

  28. Priebe, V.: Average-case complexity of shortest-paths problems. Ph.D. thesis, Saarland University (2001). http://scidok.sulb.uni-saarland.de/volltexte/2007/1180/

  29. Roditty, L., Zwick, U.: Replacement paths and k simple shortest paths in unweighted directed graphs. ACM Trans. Algorithms (TALG) 8(4), 33 (2012)

    Google Scholar 

  30. Sedeño-Noda, A.: An efficient time and space K point-to-point shortest simple paths algorithm. Appl. Math. Comput. 218(20), 10244–10257 (2012)

    Google Scholar 

  31. Shih, Y.K., Parthasarathy, S.: A single source k-shortest paths algorithm to infer regulatory pathways in a gene network. Bioinformatics 28(12), i49–i58 (2012)

    Google Scholar 

  32. Williams, V.V., Williams, R.: Subcubic equivalences between path, matrix and triangle problems. In: Proceedings of the 51th FOCS, pp. 645–654 (2010)

    Google Scholar 

  33. Yen, J.Y.: Finding the \(k\) shortest loopless paths in a network. Manag. Sci. 17(11), 712–716 (1971)

    Google Scholar 

Download references

Acknowledgements

We are grateful to Erika Duriakova for providing us the code for the implementation of Yen’s algorithm, the SSSP subroutines and her generous help with debugging our usage of her code.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Deepak Ajwani .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Schickedanz, A., Ajwani, D., Meyer, U., Gawrychowski, P. (2019). Average-Case Behavior of k-Shortest Path Algorithms. In: Aiello, L., Cherifi, C., Cherifi, H., Lambiotte, R., Lió, P., Rocha, L. (eds) Complex Networks and Their Applications VII. COMPLEX NETWORKS 2018. Studies in Computational Intelligence, vol 812. Springer, Cham. https://doi.org/10.1007/978-3-030-05411-3_3

Download citation

Publish with us

Policies and ethics