Abstract
Graph algorithms have long been a challenge to program in a pure functional language. Previous attempts have either tended to be unreadable, or have failed to achieve standard asymptotic complexity measures. We explore a number of graph search algorithms in which we achieve standard complexities, while significantly improving upon traditional imperative presentations. In particular, we construct the algorithms from reusable components, so providing a greater level of modularity than is typical elsewhere. Furthermore, we provide examples of correctness proofs which are quite different from traditional proofs, largely because they are not based upon reasoning about the dynamic process of graph traversal, but rather reason about a static value.
Preview
Unable to display preview. Download preview PDF.
References
T.H.Corman, C.E.Leiserson, and R.L.Rivest, Introduction to Algorithms. MIT Press, MA, 1990.
J.Darlington and R.Burstall, A System which Automatically Improves Programs. Acta Informatica, 6(1), pp 41–60, 1976.
R.Harrison, Abstract Data Types in Standard ML. John Wiley and Sons, 1993.
I.Holyer, Functional Programming with Miranda. Pitman, London, 1991.
J.E.Hopcroft and R.E.Tarjan, Algorithm 447: Efficient Algorithms for Graph Manipulation. Communications of the ACM, 16(6), pp 372–378.
R.J.M.Hughes, Lazy Memo Functions. Proc. FPCA 85, Nancy, LNCS 201, Springer-Verlag, 1985.
T.Johnsson, Efficient Graph Algorithms Using Lazy Monolithic Arrays, unpublished.
D.King and J.Launchbury, Structuring Depth-First Search Algorithms in Haskell. Proc. POPL, San Francisco, CA, 1995.
J.Launchbury and S.Peyton Jones, Lazy Functional State Threads. Proc. PLDI, Orlando, FL, 1994.
J.Launchbury and S.Peyton Jones, State in Haskell. LASC Special issue on State in Programming Languages, to appear.
U.Manber, Introduction to Algorithms—A Creative Approach. Addison-Wesley, MA, 1989.
E.Moggi, Computational Lambda-Calculus and Monads. Proc LICS, Asilomar, CA, 1989.
L.C.Paulson, ML for the working programmer. Cambridge University Press, 1991.
M.Sharir, A Strong-Connectivity Algorithm and its Application in Data Flow Analysis. Computers and Mathematics with Applications, 7(1), pp 67–72.
R.E.Tarjan, Depth-first Search and Linear Graph Algorithms. SIAM J. of Computing, 1(2), pp 146–160.
P.Wadler, Comprehending Monads, Proc. L&FP, Nice, France, 1990.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1995 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Launchbury, J. (1995). Graph algorithms with a functional flavour. In: Jeuring, J., Meijer, E. (eds) Advanced Functional Programming. AFP 1995. Lecture Notes in Computer Science, vol 925. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-59451-5_9
Download citation
DOI: https://doi.org/10.1007/3-540-59451-5_9
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-59451-2
Online ISBN: 978-3-540-49270-2
eBook Packages: Springer Book Archive