Computing the K Shortest Paths: A New Algorithm and an Experimental Comparison

  • Víctor M. Jiménez
  • Andrés Marzal
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1668)


A new algorithm to compute the K shortest paths (in order of increasing length) between a given pair of nodes in a digraph with n nodes and m arcs is presented. The algorithm recursively and efficiently solves a set of equations which generalize the Bellman equations for the (single) shortest path problem and allows a straightforward implementation. After the shortest path from the initial node to every other node has been computed, the algorithm finds the K shortest paths in O(m+ K n log(m/n)) time. Experimental results presented in this paper show that the algorithm outperforms in practice the algorithms by Eppstein [7],[8] and by Martins and Santos [15] for different kinds of random generated graphs.


Short Path Short Path Problem Bellman Equation Recursive Call Short Path Algorithm 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Azevedo, J.A., Costa, M.E.O.S., Madeira, J.J.E.R.S., Martins, E.Q.V.: An Algorithm for the Ranking of Shortest Paths. European J. Op. Res. 69 (1993) 97–106zbMATHCrossRefGoogle Scholar
  2. 2.
    Azevedo, J.A., Madeira, J.J.E.R.S., Martins, E.Q.V., Pires, F.P.A.: A Computational Improvement for a Shortest Paths Ranking Algorithm. European J. Op. Res. 73 (1994) 188–191zbMATHCrossRefGoogle Scholar
  3. 3.
    Bellman, R.: On a Routing Problem. Quarterly Applied Math. 16 (1958) 87–90zbMATHGoogle Scholar
  4. 4.
    Bellman, R., Kalaba, R.: On kth Best Policies. J. SIAM 8 (1960) 582–588MathSciNetGoogle Scholar
  5. 5.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L.: Introduction to Algorithms. The MIT Press, Cambridge, MA (1990)zbMATHGoogle Scholar
  6. 6.
    Dreyfus, S.E.: An Appraisal of Some Shortest Path Algorithms. Op. Res. 17 (1969) 395–412zbMATHCrossRefGoogle Scholar
  7. 7.
    Eppstein, D.: Finding the k Shortest Paths. In: Proc. 35th IEEE Symp. FOCS (1994) 154–165Google Scholar
  8. 8.
    Eppstein, D.: Finding the k Shortest Paths. SIAM J. Computing 28(2) (1999) 652–673CrossRefMathSciNetGoogle Scholar
  9. 9.
    Fox, B.L.: Calculating kth Shortest Paths. INFOR-Canad. J. Op. Res. and Inform. Proces. 11(1) (1973) 66–70zbMATHGoogle Scholar
  10. 10.
    Fox, B.L.: Data Structures and Computer Science Techniques in Operations Research. Op. Res. 26(5) (1978) 686–717zbMATHGoogle Scholar
  11. 11.
    Jiménez, V.M., Marzal, A.: A New Algorithm for Finding the N-Best Sentence Hypotheses in Continuous Speech Recognition. In: Casacuberta, F., Sanfeliu, A. (eds.): Advances in Pattern Recognition and Applications. World Scientific (1994) 218–228. Translated from Proc. V Symp. of Spanish AERFAI (1992) 180-187Google Scholar
  12. 12.
    Jiménez, V.M., Marzal, A., Monné, J.: A Comparison of Two Exact Algorithms for Finding the N-Best Sentence Hypotheses in Continuous Speech Recognition. In: Proc. 4th ESCA Conf. EUROSPEECH (1995) 1071–1074Google Scholar
  13. 13.
    Jiménez, V.M., Marzal, A., Vidal, E.: Efficient Enumeration of Sentence Hypotheses in Connected Word Recognition. In: Proc. 3rd ESCA Conf. EUROSPEECH (1993) 2183–2186Google Scholar
  14. 14.
    Martins, E. Q. V.: An Algorithm for Ranking Paths that may Contain Cycles. European J. Op. Res. 18 (1984) 123–130zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Martins, E.Q.V., Santos, J.L.E.: A New Shortest Paths Ranking Algorithm. Technical report, Univ. de Coimbra, (1996)
  16. 16.
    Marzal, A.: Cálculo de las K Mejores Soluciones a Problemas de Programación Dinámica. PhD thesis (in Spanish), Univ. Politécnica de Valencia, Spain (1994)Google Scholar
  17. 17.
    Marzal, A., Vidal, E.: A N-best sentence hypotheses enumeration algorithm with duration constraints based on the two level algorithm. In Proc. of the Int. Conf. on Pattern Recognition (1992)Google Scholar
  18. 18.
    Miaou, S.P., Chin, S.M.: Computing K-Shortest Paths for Nuclear Spent Fuel Highway Transportation. European J. Op. Res. 53 (1991) 64–80CrossRefGoogle Scholar
  19. 19.
    Shier, D.R.: Iterative Methods for Determining the k Shortest Paths in a Network. Networks 6 (1976) 205–229zbMATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Shier, D.R.: On Algorithms for Finding the k Shortest Paths in a Network. Networks 9 (1979) 195–214zbMATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Skicism, C.C., Golden, B.L.: Computing k-Shortest Path Lengths in Euclidean Networks. Networks 17 (1987) 341–352CrossRefMathSciNetGoogle Scholar
  22. 22.
    Skicism, C.C., Golden, B.L.: Solving k-Shortest and Constrained Shortest Path Problems Efficiently. Annals of Op. Res. 20 (1989) 249–282CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Víctor M. Jiménez
    • 1
  • Andrés Marzal
    • 1
  1. 1.Departamento de InformáticaUniversitat Jaume ICastellónSpain

Personalised recommendations