Formal Aspects of Computing

, Volume 24, Issue 4–6, pp 459–476 | Cite as

Dijkstra, Floyd and Warshall meet Kleene

  • Peter Höfner
  • Bernhard Möller
Original Article


Around 1960, Dijkstra, Floyd and Warshall published papers on algorithms for solving single-source and all-sources shortest path problems, respectively. These algorithms, nowadays named after their inventors, are well known and well established. This paper sheds an algebraic light on these algorithms. We combine the shortest path problems with Kleene algebra, also known as Conway’s regular algebra. This view yields a purely algebraic version of Dijkstra’s shortest path algorithm and the one by Floyd/Warshall. Moreover, the algebraic abstraction yields applications of these algorithms to structures different from graphs and pinpoints the mathematical requirements on the underlying cost algebra that ensure their correctness.


Algebra Algorithms Shortest-path Kleene algebra Semiring 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. AHU74.
    Aho AV, Hopcroft JE, Ullman JD (1974) The design and analysis of computer algorithms. Addison-Wesley, USAzbMATHGoogle Scholar
  2. BC75.
    Backhouse R, Carré B (1975) Regular algebra applied to path-finding problems. IMA J Appl Math 15(2): 161–186zbMATHCrossRefGoogle Scholar
  3. BEG94.
    Backhouse R, van den Eijnde J, van Gasteren A (1994) Calculating path algorithms. Sci Comput Progr 22(1–2): 3–19zbMATHCrossRefGoogle Scholar
  4. Bel58.
    Bellman R (1958) On a routing problem. Quart Appl Math 16: 87–90MathSciNetzbMATHGoogle Scholar
  5. Ber62.
    Berge C (1962) The theory of graphs and its applications. MethuenGoogle Scholar
  6. Car71.
    Carré B (1971) An algebra for network routing problems. IMA J Appl Math 7: 273–294zbMATHCrossRefGoogle Scholar
  7. Car79.
    Carré B (1979) Graphs and networks.Oxford applied mathematics and computing science series. Clarendon Press, Oxford UniversityGoogle Scholar
  8. CFM08.
    Coltun R, Ferguson D, Moy J (2008) OSPF for IPv6. RFC 2328 (Standard, Errata Exist)Google Scholar
  9. Con71.
    Conway J (1971) Regular algebra and finite machines. Chapman and Hall, LondonGoogle Scholar
  10. Dan60.
    Dantzig G (1960) On the shortest route through a network. Manag Sci 6: 187–190MathSciNetzbMATHCrossRefGoogle Scholar
  11. Dij59.
    Dijkstra E (1959) A note on two problems in connexion with graphs. Numer Mathe 1: 269–271MathSciNetzbMATHCrossRefGoogle Scholar
  12. DP02.
    Davey B, Priestley H (2002) Introduction to lattices and order. Cambridge University Press, LondonzbMATHCrossRefGoogle Scholar
  13. Flo62.
    Floyd R (1962) Algorithm 97: Shortest path. Commun ACM 5: 345CrossRefGoogle Scholar
  14. GM79.
    Gondran M, Minoux M (1979) Graphes et algorithmes. EyrollesGoogle Scholar
  15. GM88.
    Gondran M, Minoux M (1988) Graphs and Algorithms. WileyGoogle Scholar
  16. GM08.
    Gondran M, Minoux M (2008) Graphs, Dioids and Semirings—new models and algorithms. Springer, BerlinzbMATHGoogle Scholar
  17. HM11.
    Höfner P, McIver A (2011) Towards an algebra of routing tables. In: de Swart H (ed) Relations and Kleene algebra in computer science, lecture notes in computer science, vol 6663. Springer, Berlin, pp 212–229Google Scholar
  18. Hol98.
    Hollenberg M (1998) Equational axioms of test algebra. In: Nielsen M, Thomas W (eds) CSL ’97: selected papers from the 11th international workshop on computer science logic, lecture notes in computer science, vol 1414Google Scholar
  19. HS07.
    Höfner P, Struth G (2007) Automated reasoning in Kleene algebra. In: Pfennig F (ed) Automated deduction, lecture notes in artificial intelligence, vol 4603. Springer, Berlin, pp 279–294Google Scholar
  20. Kle51.
    Kleene S (1951) Representation of events in nerve nets and finite automata. Technical Report RM-704, RAND Corporation RAND Research MemorandumGoogle Scholar
  21. Kle52.
    Kleene SC (1952) Introduction to metamathematics. Van NostrandGoogle Scholar
  22. Koz94.
    Kozen D (1994) A completeness theorem for Kleene algebras and the algebra of regular events. Inf Comput 110(2): 366–390MathSciNetzbMATHCrossRefGoogle Scholar
  23. Koz97.
    Kozen D (1997) Kleene algebra with tests. ACM Trans Progr Lang Syst 19(3): 427–443CrossRefGoogle Scholar
  24. LT91a.
    Lengauer T, Theune D (1991) Efficient algorithms for path problems with general cost citeria. In: Leach Albert J, Burkhard Monien B, Rodríguez-Artalejo M (eds) Automata, languages and programming, 18th International colloquium, ICALP91, Madrid, Spain, July 8–12, 1991, proceedings. Lecture notes in computer science vol 510. Springer, Berlin, pp 314–326Google Scholar
  25. LT91b.
    Lengauer T, Theune D (1991) Unstructured path problems and the making of semirings (preliminary version). In: Dehne F, Sack J-R, Santoro N (eds) Algorithms and data structures, 2nd workshop WADS ’91, Ottawa, Canada, August 14–16, 1991, proceedings. Lecture notes in computer science, vol 519. Springer, Berlin, pp 189–200Google Scholar
  26. Moy98.
    Moy J (1998) OSPF version 2. RFC 2328 (Standard, Errata Exist)Google Scholar
  27. Ora90 .
    Oran D (1990) IS-IS protocol specification (IETF). RFC 1142 (Informational)Google Scholar
  28. PBD03.
    Perkins C, Belding-Royer E, Das S (2003) Ad hoc on-demand distance vector (AODV) routing. RFC 3561 (Experimental)Google Scholar
  29. Roy59.
    Roy B (1959) Transitivité et connexité. Comptes Rendus de l’Académie des Sci Paris 249: 216–218zbMATHGoogle Scholar
  30. Tar81.
    Tarjan R. (1981) A unified approach to path problems. J ACM 28: 577–593MathSciNetzbMATHCrossRefGoogle Scholar
  31. War62.
    Warshall S (1962) A theorem on boolean matrices. J ACM 9(1): 11–12MathSciNetzbMATHCrossRefGoogle Scholar

Copyright information

© British Computer Society 2012

Authors and Affiliations

  1. 1.NICTASydneyAustralia
  2. 2.University of New South WalesSydneyAustralia
  3. 3.Universität AugsburgAugsburgGermany

Personalised recommendations