Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/199448.199530acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article
Free access

Structuring depth-first search algorithms in Haskell

Published: 25 January 1995 Publication History

Abstract

Depth-first search is the key to a wide variety of graph algorithms. In this paper we express depth-first search in a lazy functional language, obtaining a linear-time implementation. Unlike traditional imperative presentations, we use the structuring methods of functional languages to construct algorithms from individual reusable components. This style of algorithm construction turns out to be quite amenable to formal proof, which we exemplify through a calculational-style proof of a far from obvious strongly-connected components algorithm.

References

[1]
Barth, P. S., Nikhil, R. S. and Arvind (1991), M-structures: Extending a parallel, non-strict, functional language with state, in J. Hughes, ed., 'Conference on Functional Programming Languages and Computer Architecture', LNCS 523, Springer-Verlag, Cambridge, Massachusetts, pp. 538-568.
[2]
Burton, F. W. and Yang, H.-K. (1990), 'Manipulating muI- tilinked data structures in a pure functional language', Software--Practice and Experience 20, 1167-1185.
[3]
Corman, T. H., Leiserson, C. E. and Rivest, R. L. (1990), Introduction to Algorithms, The MIT Press, Cambridge, Massachusetts.
[4]
Erwig, M. (1992), Graph algorithms = iteration + data structures? The structure of graph algorithms and a style of programming, in E. Mayr, ed., 'Graph- Theoretic Concepts in Computer Science', LNCS 657, Springer-Verlag, pp. 277-292.
[5]
Harrison, R. (1993), Abstract data types in Standard ML, John Wiley and Sons.
[6]
Holyer, I. (1991), Functional programming with Miranda, Pitman, London.
[7]
Hopcroft, J. E. and Tarjan, R. E. (1973), 'Algorithm 447: Efficient algorithms for graph manipulation', Communications of the ACM 16(6), 372-378.
[8]
Hudak, P., Peyton Jones, S. L., Wadler, P., Arvind, Boutel, B., Fairbairn, J., Fasel, J., Guzm~n, M. M., Hammond, K., Hughes, j., johnsson, T., Kieburtz, R., Nikhil, R. S., Partain, W. and Peterson, J. (1992), 'Report on the functional programming language Haskell, Version 1.2', A CM SIGPLAN Notices 27(5).
[9]
Kashiwagi, Y. and Wise, D. S. (1991), Graph algorithms in a lazy functional programming language, in 'Proceedings of the 4'th International Symposium on Lucid and intensional Programming', pp. 35-46. Also available as Technical Report Number 330, Computer Science Department, Indiana University.
[10]
Launchbury, J. (1993), Lazy imperative programming, in 'Workshop on State in Programming Languages', ACM SIGPLAN, Copenhagen, Denmark, pp. 46-56.
[11]
Launchbury, J. and Peyton Jones, S. L. (1994), Lazy functional state threads, in 'Conference on Programming Language Design and Implementation', ACM SIG- PLAN, Orlando, Florida.
[12]
Manber, U. (1989), Introduction to Algorithms--A Creative Approach, Addison-Wesley, Reading, Massachusetts.
[13]
Moggi, E. (1989), Computational lambda-calculus and monads, in 'Symposium on Logic in Computer Science', IEEE, Asilomar, California.
[14]
Paulson, L. C. (1991), ML for the working programmer, Cambridge University Press, Cambridge.
[15]
Peyton Jones, S. L. and Wadler, P. (1993), Imperative functional programming, in '20'th Symposium on Principles of Programming Languages', ACM, Charleston, North Carolina.
[16]
Reif, J. H. (1985), 'Depth-first search is inherently sequentiM', Information Processing Letters 20, 229-234.
[17]
Sands, D. (1993), A nai've time analysis and its theory of cost equivalence, TOPPS report D-173, DIKU, University of Copenhagen, Denmark.
[18]
Sharir, M. (1981), 'A strong-connectivity algorithm and its applications in data flow analysis', Computers and mathematics with applications 7(1), 67-72.
[19]
Tarjan, R. E. (1972), 'Depth-first search and linear graph algorithms', SIAM Journal of Computing 1(2), 146- 160.
[20]
Wadler, P. (1990), Comprehending monads, in 'Conference on Lisp and Functional Programming', ACM, Nice, France, pp. 61-78.

Cited By

View all
  • (2025)Formalising Graph Algorithms with CoinductionProceedings of the ACM on Programming Languages10.1145/37048929:POPL(1657-1686)Online publication date: 9-Jan-2025
  • (2024)Beyond Trees: Calculating Graph-Based Compilers (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746388:ICFP(370-394)Online publication date: 15-Aug-2024
  • (2023)A Model Checker for Operator Precedence LanguagesACM Transactions on Programming Languages and Systems10.1145/360844345:3(1-66)Online publication date: 23-Sep-2023
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '95: Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 1995
415 pages
ISBN:0897916921
DOI:10.1145/199448
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 January 1995

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Conference

POPL95
POPL95: 22nd ACM Symposium on Principles of Programming Languages
January 23 - 25, 1995
California, San Francisco, USA

Acceptance Rates

Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)257
  • Downloads (Last 6 weeks)46
Reflects downloads up to 13 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Formalising Graph Algorithms with CoinductionProceedings of the ACM on Programming Languages10.1145/37048929:POPL(1657-1686)Online publication date: 9-Jan-2025
  • (2024)Beyond Trees: Calculating Graph-Based Compilers (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746388:ICFP(370-394)Online publication date: 15-Aug-2024
  • (2023)A Model Checker for Operator Precedence LanguagesACM Transactions on Programming Languages and Systems10.1145/360844345:3(1-66)Online publication date: 23-Sep-2023
  • (2021)Algebras for weighted searchProceedings of the ACM on Programming Languages10.1145/34735775:ICFP(1-30)Online publication date: 19-Aug-2021
  • (2019)Linear algebraic depth-first searchProceedings of the 6th ACM SIGPLAN International Workshop on Libraries, Languages and Compilers for Array Programming10.1145/3315454.3329962(93-104)Online publication date: 8-Jun-2019
  • (2019)An Analysis of Repeated Graph SearchMathematics of Program Construction10.1007/978-3-030-33636-3_11(298-328)Online publication date: 20-Oct-2019
  • (2018)A Distributed Framework for Low-Latency OpenVX over the RDMA NoC of a Clustered Manycore2018 IEEE High Performance extreme Computing Conference (HPEC)10.1109/HPEC.2018.8547736(1-7)Online publication date: Sep-2018
  • (2017)Algebraic graphs with class (functional pearl)ACM SIGPLAN Notices10.1145/3156695.312295652:10(2-13)Online publication date: 7-Sep-2017
  • (2017)Algebraic graphs with class (functional pearl)Proceedings of the 10th ACM SIGPLAN International Symposium on Haskell10.1145/3122955.3122956(2-13)Online publication date: 7-Sep-2017
  • (2017)A functional reformulation of UnCAL graph-transformations: or, graph transformation as graph reductionProceedings of the 2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3018882.3018883(71-82)Online publication date: 2-Jan-2017
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media