Abstract
We show how formally and systematically to develop a purely functional version of Warshall’s algorithm for computing transitive closures by combining the unfold-fold technique, relation-algebra and data refinement. It is based on an implementation of relations by lists of successor lists. The final version can immediately be implemented in Haskell. This resulting Haskell program has the same runtime complexity as the traditional imperative array-based implementation of Warshall’s algorithm. We also demonstrate how it can be re-used as component in other functional algorithms.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Aarts, A., et al.: Fixed point calculus. Inform. Proc. Lett. 53, 131–136 (1996)
Aho, A., Garey, M., Ullman, J.: The transitive reduction of a directed graph. SIAM J. of Comput. 1, 131–137 (1972)
Antoy, S., Hanus, M.: Functional logic programming. Comm. of the ACM 53, 74–85 (2010)
Berghammer, R., Ehler, H., Zierer, H.: Development of graph algorithms by program transformation. In: Göttler, H., Schneider, H.-J. (eds.) WG 1987. LNCS, vol. 314, pp. 206–218. Springer, Heidelberg (1988)
Berghammer, R., von Karger, B.: Algorithms from relational specification. In: Brink, C., Kahl, W., Schmidt, G. (eds.) Relational Methods in Computer Science, pp. 131–149. Springer, Heidelberg (1997)
Berghammer, R., Neumann, F.: RelView – An OBDD-Based Computer Algebra System for Relations. In: Ganzha, V.G., Mayr, E.W., Vorozhtsov, E.V. (eds.) CASC 2005. LNCS, vol. 3718, pp. 40–51. Springer, Heidelberg (2005)
Berghammer, R., Fischer, S.: Implementing relational specifications in a constraint functional language. Electr. Notes on Theor. Comput. Sci. 177, 169–183 (2007)
Berghammer, R.: Ordnungen, Verbände und Relationen mit Anwendungen (Orders, lattices and relations with applications). Vieweg-Teubner, Stuttgart (2008)
Bird, R.: Introduction to functional programming using Haskell, 2nd edn. Prentice-Hall, Englewood Cliffs (1998)
Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. J. of the ACM 24, 44–67 (1977)
Chen, Y.: On the evaluation of large and sparse graph reachability queries. In: Bhowmick, S.S., Küng, J., Wagner, R. (eds.) DEXA 2008. LNCS, vol. 5181, pp. 97–105. Springer, Heidelberg (2008)
Erwig, M.: Functional programming with graphs. ACM SIGPLAN Notices 32, 52–65 (1997)
Erwig, M.: Inductive graphs and functional graph algorithms. J. of Funct. Progr. 11, 467–492 (2001)
Floyd, R.W.: Algorithm 97 (Shortest path). Comm. of the ACM 5, 345 (1962)
Fredmann, M.L.: New bounds on the complexity of the shortest path problem. SIAM J. on Comput. 5, 83–89 (1976)
Gibbons, J.: An initial algebra approach to directed graphs. In: Möller, B. (ed.) MPC 1995. LNCS, vol. 947, pp. 282–303. Springer, Heidelberg (1995)
Kahl, W.: Semigroupoid interfaces for relation-algebraic programming in Haskell. In: Schmidt, R.A. (ed.) RelMiCS/AKA 2006. LNCS, vol. 4136, pp. 235–250. Springer, Heidelberg (2006)
King, D.J., Launchbury, J.: Structuring depth-first search algorithms in Haskell. In: ACM Symposium on Principles of Programming, pp. 344–356. ACM, New York (1995)
Launchbury, J.: Graph algorithms with a functional flavour. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 308–331 (2005)
Lohrey, M.: Complexity results for confluence problems. In: Kutyłowski, M., Wierzbicki, T., Pacholski, L. (eds.) MFCS 1999. LNCS, vol. 1672, pp. 114–124. Springer, Heidelberg (1999)
Penn, G.: The algebraic structure of transitive closure and its application to attributed type signatures. Grammars 3, 295–312 (2000)
Schmidt, G., Ströhlein, T.: Relations and graphs. Discrete Mathematics for Computer Scientists. Springer, Heidelberg (1993)
Schmidt, G.: A proposal for a multilevel relational reference language. J. of Relat. Meth. in Comput. Sci. 1, 314–338 (2004)
Strassen, V.: Gaussian elimination is not optimal. Num. Math. 13, 354–356 (1969)
Thompson, S.: Haskell – The craft of functional programming. Addison-Wesley, Reading (1999)
Warshall, S.: A theorem on Boolean matrices. J. of the ACM 9, 11–12 (1962)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Berghammer, R. (2011). A Functional, Successor List Based Version of Warshall’s Algorithm with Applications. In: de Swart, H. (eds) Relational and Algebraic Methods in Computer Science. RAMICS 2011. Lecture Notes in Computer Science, vol 6663. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-21070-9_10
Download citation
DOI: https://doi.org/10.1007/978-3-642-21070-9_10
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-21069-3
Online ISBN: 978-3-642-21070-9
eBook Packages: Computer ScienceComputer Science (R0)