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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 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.
For \(p\ge 4/n\) the size of the giant strong component is \(\varOmega (n)\) w.h.p. [20].
- 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.
We note that for convex properties, the G(n, p) and G(n, m) 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(n, m) model should also hold for the G(n, p) model.
References
Agarwal, U., Ramachandran, V.: Finding \(k\) simple shortest paths and cycles. In: Proceedings of the 27th ISAAC, LIPIcs, pp. 8:1–8:12 (2016)
Agarwal, U., Ramachandran, V.: Fine-grained complexity for sparse graphs. Proceedings of the 50th STOC, pp. 239–252. ACM (2018)
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)
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)
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)
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)
Bollobás, B.: Models of Random Graphs. Cambridge Studies in Advanced Mathematics, 2nd edn, pp. 34–59. Cambridge University Press, Cambridge (2001)
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
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)
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)
Dijkstra, E.W.: A note on two problems in connexion with graphs. Numer. Math. 1(1), 269–271 (1959)
Eppstein, D.: Finding the \(k\) shortest paths. SIAM J. Comput. 28(2), 652–673 (1998)
Feng, G.: Finding k shortest simple paths in directed graphs: a node classification algorithm. Networks 64(1), 6–17 (2014)
Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM (JACM) 34(3), 596–615 (1987)
Frieder, A., Roditty, L.: An experimental study on approximating \(k\) shortest simple paths. J. Exp. Algorithmics (JEA) 19, 1–5 (2015)
Goldberg, A.V.: A practical shortest path algorithm with linear expected time. SIAM J. Comput. 37(5), 1637–1655 (2008)
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)
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)
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)
Karp, R.M.: The transitive closure of a random digraph. Random Struct. Algorithms 1(1), 73–94 (1990)
Katoh, N., Ibaraki, T., Mine, H.: An efficient algorithm for k shortest simple paths. Networks 12(4), 411–427 (1982)
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)
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)
Martins, E., Pascoal, M.M., Santos, J.: Deviation algorithms for ranking shortest paths. Int. J. Found. Comput. Sci. 10(3), 247–262 (1999)
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)
Meyer, U.: Average-case complexity of single-source shortest-paths algorithms: lower and upper bounds. J. Algorithms 48(1), 91–134 (2003)
Perko, A.: Implementation of algorithms for k shortest loopless paths. Networks 16(2), 149–160 (1986)
Priebe, V.: Average-case complexity of shortest-paths problems. Ph.D. thesis, Saarland University (2001). http://scidok.sulb.uni-saarland.de/volltexte/2007/1180/
Roditty, L., Zwick, U.: Replacement paths and k simple shortest paths in unweighted directed graphs. ACM Trans. Algorithms (TALG) 8(4), 33 (2012)
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)
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)
Williams, V.V., Williams, R.: Subcubic equivalences between path, matrix and triangle problems. In: Proceedings of the 51th FOCS, pp. 645–654 (2010)
Yen, J.Y.: Finding the \(k\) shortest loopless paths in a network. Manag. Sci. 17(11), 712–716 (1971)
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
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
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
DOI: https://doi.org/10.1007/978-3-030-05411-3_3
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-05410-6
Online ISBN: 978-3-030-05411-3
eBook Packages: Intelligent Technologies and RoboticsIntelligent Technologies and Robotics (R0)