Graph algorithms with a functional flavour

  • John Launchbury
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 925)


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.


Graph Algorithm Functional Language Tree Edge Span Forest Topological Sort 
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. [CLR90]
    T.H.Corman, C.E.Leiserson, and R.L.Rivest, Introduction to Algorithms. MIT Press, MA, 1990.Google Scholar
  2. [DB76]
    J.Darlington and R.Burstall, A System which Automatically Improves Programs. Acta Informatica, 6(1), pp 41–60, 1976.Google Scholar
  3. [Har93]
    R.Harrison, Abstract Data Types in Standard ML. John Wiley and Sons, 1993.Google Scholar
  4. [Hol91]
    I.Holyer, Functional Programming with Miranda. Pitman, London, 1991.Google Scholar
  5. [HT73]
    J.E.Hopcroft and R.E.Tarjan, Algorithm 447: Efficient Algorithms for Graph Manipulation. Communications of the ACM, 16(6), pp 372–378.Google Scholar
  6. [Hug85]
    R.J.M.Hughes, Lazy Memo Functions. Proc. FPCA 85, Nancy, LNCS 201, Springer-Verlag, 1985.Google Scholar
  7. [Joh]
    T.Johnsson, Efficient Graph Algorithms Using Lazy Monolithic Arrays, unpublished.Google Scholar
  8. [KL95]
    D.King and J.Launchbury, Structuring Depth-First Search Algorithms in Haskell. Proc. POPL, San Francisco, CA, 1995.Google Scholar
  9. [LPJ94]
    J.Launchbury and S.Peyton Jones, Lazy Functional State Threads. Proc. PLDI, Orlando, FL, 1994.Google Scholar
  10. [LPJ]
    J.Launchbury and S.Peyton Jones, State in Haskell. LASC Special issue on State in Programming Languages, to appear.Google Scholar
  11. [Man89]
    U.Manber, Introduction to Algorithms—A Creative Approach. Addison-Wesley, MA, 1989.Google Scholar
  12. [Mog89]
    E.Moggi, Computational Lambda-Calculus and Monads. Proc LICS, Asilomar, CA, 1989.Google Scholar
  13. [Pau91]
    L.C.Paulson, ML for the working programmer. Cambridge University Press, 1991.Google Scholar
  14. [Sha81]
    M.Sharir, A Strong-Connectivity Algorithm and its Application in Data Flow Analysis. Computers and Mathematics with Applications, 7(1), pp 67–72.Google Scholar
  15. [Tar72]
    R.E.Tarjan, Depth-first Search and Linear Graph Algorithms. SIAM J. of Computing, 1(2), pp 146–160.Google Scholar
  16. [Wad90]
    P.Wadler, Comprehending Monads, Proc. L&FP, Nice, France, 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • John Launchbury
    • 1
  1. 1.Oregon Graduate InstituteUSA

Personalised recommendations