Advertisement

Average-Case Behavior of k-Shortest Path Algorithms

  • Alexander Schickedanz
  • Deepak Ajwani
  • Ulrich Meyer
  • Pawel Gawrychowski
Conference paper
Part of the Studies in Computational Intelligence book series (SCI, volume 812)

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.

Keywords

k-Shortest path algorithms Average case analysis Yen’s algorithm Feng’s algorithm 

Notes

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.

References

  1. 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. 2.
    Agarwal, U., Ramachandran, V.: Fine-grained complexity for sparse graphs. Proceedings of the 50th STOC, pp. 239–252. ACM (2018)Google Scholar
  3. 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. 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. 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. 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. 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. 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.0720Google Scholar
  9. 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. 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. 11.
    Dijkstra, E.W.: A note on two problems in connexion with graphs. Numer. Math. 1(1), 269–271 (1959)Google Scholar
  12. 12.
    Eppstein, D.: Finding the \(k\) shortest paths. SIAM J. Comput. 28(2), 652–673 (1998)Google Scholar
  13. 13.
    Feng, G.: Finding k shortest simple paths in directed graphs: a node classification algorithm. Networks 64(1), 6–17 (2014)Google Scholar
  14. 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. 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. 16.
    Goldberg, A.V.: A practical shortest path algorithm with linear expected time. SIAM J. Comput. 37(5), 1637–1655 (2008)Google Scholar
  17. 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. 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. 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. 20.
    Karp, R.M.: The transitive closure of a random digraph. Random Struct. Algorithms 1(1), 73–94 (1990)Google Scholar
  21. 21.
    Katoh, N., Ibaraki, T., Mine, H.: An efficient algorithm for k shortest simple paths. Networks 12(4), 411–427 (1982)Google Scholar
  22. 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. 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. 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. 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. 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. 27.
    Perko, A.: Implementation of algorithms for k shortest loopless paths. Networks 16(2), 149–160 (1986)Google Scholar
  28. 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. 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. 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. 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. 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. 33.
    Yen, J.Y.: Finding the \(k\) shortest loopless paths in a network. Manag. Sci. 17(11), 712–716 (1971)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Alexander Schickedanz
    • 1
  • Deepak Ajwani
    • 2
  • Ulrich Meyer
    • 1
  • Pawel Gawrychowski
    • 3
  1. 1.Goethe UniversityFrankfurt am MainGermany
  2. 2.Nokia Bell LabsDublinIreland
  3. 3.Instytut InformatykiUniwersytet WroclawskiWroclawPoland

Personalised recommendations