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

Functional programming with graphs

Published: 01 August 1997 Publication History
  • Get Citation Alerts
  • Abstract

    Graph algorithms expressed in functional languages often suffer from their inherited imperative, state-based style. In particular, this impedes formal program manipulation. We show how to model persistent graphs in functional languages by graph constructors. This provides a decompositional view of graphs which is very close to that of data types and leads to a "more fictional" formulation of graph algorithms. Graph constructors enable the definition of general fold operations for graphs. We present a promotion theorem for one of these folds that allows program fusion and the elimination of intermediate results. Fusion is not restricted to the elimination of tree-like structures, and we prove another theorem that facilitates the elimination of intermediate graphs. We describe an ML-implementation of persistent graphs which efficiently supports the presented fold operators. For example, depth-first-search expressed by a fold over a functional graph has the same complexity as the corresponding imperative algorithm.

    References

    [1]
    A. Aasa, S. HolstrSm, and C. Nilsson. An Efficiency Comparison of Some Representations of Purely Functional Arrays. BIT, 28:490-503, 1988.
    [2]
    S. Adams. Efficient Sets - A Balancing Act. Journal o/Functional Programming, 3:553-561, 1993.
    [3]
    R. S. Bird. Functional Algorithm Design. In Mathematics of Program Construction, LNCS 947, pages 2-17, 1995.
    [4]
    F. W. Burton and H.-K. Yang. Manipulating Multilinked Data Structures in a Pure Functional Language. Sof'tware - Practice and E~'perience, 20(11):1167-1185, 1990.
    [5]
    P. F. Dietz. Fully Persistent Arrays. In Workshop on Algorithms and Data Structures, LNCS 382, pages 67- 74, 1989.
    [6]
    J. R. DriscoU, N. Sarnak, D. D. Sleator, and R. E. Tarjan. Making Data Structures Persistent. Journal o/ Computer and System Sciences, 38:86-124, 1989.
    [7]
    M. Erwig. Graph Algorithms = Iteration + Data Structures? The Structure of Graph Algorithms and a Corresponding Style of Programming. In 18th Int. Workshop on Graph Theoretic Concepts in Computer Science, LNCS 657, pages 277-292, 1992.
    [8]
    M. Erwig. Active Patterns. In 8th Int. Workshop on Implementation of Fur~etional Languages, pages 95-112, 1996. To appear in LNCS.
    [9]
    M. Erwig and B. Meyer. Heterogeneous Visual Languages- Integrating Visual and Textual Programming. In 11th IEEE Syrup. on Visual Languages, pages 318- 325, 1995.
    [10]
    L. Fegaras and T. Sheard. Revisiting Catamorphisms over Datatypes with Embedded Functions. In A CM Syrup. on Principles of Programming Languages, pages 284-294, 1996.
    [11]
    J. Gibbons. An Initial Algebra Approach to Directed Acyclic Graphs. In Mathematics of Program Construction, LNCS 947, pages 282-303, 1995.
    [12]
    Z. Hu, H. Iwasaki, and M. Takeic~. Deriving Structural Hylomorphisms from Recursive Definitions. In 1st Int. Conf. on Functional Programming, pages 73-82, 1996.
    [13]
    Y. Kashiwagi and D. Wise. Graph Algorithms in a Lazy Functional Programming Language. In 4th Int. Syrup. on Lucid and Intensional Programing, pages 35-46, 1991.
    [14]
    D. J. King and J. Launchbury. Structuring Depth-First Search Algorithms in Haskell. In A CM Syrup. on Principles of Programming Languages, pages 344-354, 1995.
    [15]
    J. Launchbury. Graph Algorithms with a Functional Flavour. In 1st Int. Spring School on Advanced Functional Programming, LNCS 925, pages 308-331, 1995.
    [16]
    J. Launchbury and T. Sheaxd. Warm Fusion: Deriving Build-Catas from Recursive Definitions. In Conf. on Functional Programming and Computer Architecture, pages 314-323, 1995.
    [17]
    G. Malcom. Homomorphisms and Promotability. In Mathematics of Program Construction, LNCS 375, pages 335-347, 1989.
    [18]
    E. Meijer, M. Fokkinga, and R. Paterson. Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire. In Conf. on P~nctional Programming and Computer Architecture, pages 124-144, 1991.
    [19]
    R. Milner, M. ToRe, and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.
    [20]
    C. Okasaki. Functional Data Structures. In Advanced Functional Programming, LNCS 1129, pages 131-158, 1996.
    [21]
    P. Palao Gonstanza, R. Pefia, and M. Ndfiez. A New Look at Pattern Matching in Abstract Data Types. In 1st Int. Conf. on Functional Programming, pages 110- 121, 1996.
    [22]
    T. Sheard and L. Fegaras. A Fold for all Seasons. In Conf. on Functional Programming and Computer At. chitecture, pages 233-242, 1993.
    [23]
    P. Wadler. Views: A Way for Pattern Matching to Cohabit with Data Abstraction. In A CM Syrup. on Principles of Programming Languages, pages 307-313, 1987.
    [24]
    P. Wadler. Deforestation: Transforming Programs to Eliminate Trees. Theoretical Computer Science, 73:231-284, 1990.

    Cited By

    View all

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ICFP '97: Proceedings of the second ACM SIGPLAN international conference on Functional programming
    August 1997
    326 pages
    ISBN:0897919181
    DOI:10.1145/258948
    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: 01 August 1997

    Permissions

    Request permissions for this article.

    Check for updates

    Qualifiers

    • Article

    Conference

    ICFP97
    Sponsor:
    ICFP97: International Conference on Functional Programming 1997
    June 9 - 11, 1997
    Amsterdam, The Netherlands

    Acceptance Rates

    ICFP '97 Paper Acceptance Rate 25 of 78 submissions, 32%;
    Overall Acceptance Rate 333 of 1,064 submissions, 31%

    Upcoming Conference

    ICFP '24

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)102
    • Downloads (Last 6 weeks)21
    Reflects downloads up to 11 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2017)The Use of MMR, Diversity-Based Reranking for Reordering Documents and Producing SummariesACM SIGIR Forum10.1145/3130348.313036951:2(209-210)Online publication date: 2-Aug-2017
    • (2017)On-Line New Event Detection and TrackingACM SIGIR Forum10.1145/3130348.313036651:2(185-193)Online publication date: 2-Aug-2017
    • (2016)Datafun: a functional DatalogACM SIGPLAN Notices10.1145/3022670.295194851:9(214-227)Online publication date: 4-Sep-2016
    • (2016)Think like a vertex, behave like a function! a functional DSL for vertex-centric big graph processingACM SIGPLAN Notices10.1145/3022670.295193851:9(200-213)Online publication date: 4-Sep-2016
    • (2016)Dynamic witnesses for static type errors (or, ill-typed programs usually go wrong)ACM SIGPLAN Notices10.1145/3022670.295191551:9(228-242)Online publication date: 4-Sep-2016
    • (2016)Think like a vertex, behave like a function! a functional DSL for vertex-centric big graph processingProceedings of the 21st ACM SIGPLAN International Conference on Functional Programming10.1145/2951913.2951938(200-213)Online publication date: 4-Sep-2016
    • (2013)Structural recursion for querying ordered graphsACM SIGPLAN Notices10.1145/2544174.250060848:9(305-318)Online publication date: 25-Sep-2013
    • (2013)Analysis of Recursively Parallel ProgramsACM Transactions on Programming Languages and Systems10.1145/251818835:3(1-49)Online publication date: 1-Nov-2013
    • (2013)Structural recursion for querying ordered graphsProceedings of the 18th ACM SIGPLAN international conference on Functional programming10.1145/2500365.2500608(305-318)Online publication date: 25-Sep-2013
    • (2012)Using relations to develop a haskell program for computing maximum bipartite matchingsProceedings of the 13th international conference on Relational and Algebraic Methods in Computer Science10.1007/978-3-642-33314-9_9(130-145)Online publication date: 17-Sep-2012
    • Show More Cited By

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Get Access

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media