Results 1  10
of
10
Functional Programming with Graphs
 2ND ACM SIGPLAN INT. CONF. ON FUNCTIONAL PROGRAMMING
, 1997
"... Graph algorithms expressed in functional languages often suffer from their inherited imperative, statebased 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 g ..."
Abstract

Cited by 29 (10 self)
 Add to MetaCart
Graph algorithms expressed in functional languages often suffer from their inherited imperative, statebased 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 functional" 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 treelike structures, and we prove another theorem that facilitates the elimination of intermediate graphs. We describe an MLimplementation of persistent graphs which efficiently supports the presented fold operators. For example, depthfirstsearch expressed by a fold over a functional graph has the same complexity as the corresp...
Structuring DepthFirst Search Algorithms in Haskell
, 1995
"... Depthfirst search is the key to a wide variety of graph algorithms. In this paper we express depthfirst search in a lazy functional language, obtaining a lineartime implementation. Unlike traditional imperative presentations, we use the structuring methods of functional languages to construct alg ..."
Abstract

Cited by 26 (0 self)
 Add to MetaCart
Depthfirst search is the key to a wide variety of graph algorithms. In this paper we express depthfirst search in a lazy functional language, obtaining a lineartime 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 calculationalstyle proof of a far from obvious stronglyconnected components algorithm. Classifications: Computing Paradigms (functional programming) ; Environments, Implementations, and Experience (programming, graph algorithms). 1 Introduction The importance of depthfirst search (DFS) for graph algorithms was established twenty years ago by Tarjan (1972) and Hopcroft and Tarjan (1973) in their seminal work. They demonstrated how depthfirst search could be used to construct a variety of efficient graph algorithms. In practice, this...
Inductive Graphs and Functional Graph Algorithms
, 2001
"... We propose a new style of writing graph algorithms in functional languages which is based on an alternative view of graphs as inductively defined data types. We show how this graph model can be implemented efficiently, and then we demonstrate how graph algorithms can be succinctly given by recursive ..."
Abstract

Cited by 17 (2 self)
 Add to MetaCart
We propose a new style of writing graph algorithms in functional languages which is based on an alternative view of graphs as inductively defined data types. We show how this graph model can be implemented efficiently, and then we demonstrate how graph algorithms can be succinctly given by recursive function definitions based on the inductive graph view. We also regard this as a contribution to the teaching of algorithms and data structures in functional languages since we can use the functionalstyle graph algorithms instead of the imperative algorithms that are dominant today. Keywords: Graphs in Functional Languages, Recursive Graph Algorithms, Teaching Graph Algorithms in Functional Languages
Lazy DepthFirst Search and Linear Graph Algorithms in Haskell
 Glasgow Workshop on Functional Programming
, 1994
"... Depthfirst search is the key to a wide variety of graph algorithms. In this paper we explore the implementation of depth first search in a lazy functional language. For the first time in such languages we obtain a lineartime implementation. But we go further. Unlike traditional imperative presenta ..."
Abstract

Cited by 6 (0 self)
 Add to MetaCart
Depthfirst search is the key to a wide variety of graph algorithms. In this paper we explore the implementation of depth first search in a lazy functional language. For the first time in such languages we obtain a lineartime implementation. But we go further. Unlike traditional imperative presentations, algorithms are constructed from individual components, which may be reused to create new algorithms. Furthermore, the style of program is quite amenable to formal proof, which we exemplify through a calculationalstyle proof of a stronglyconnected components algorithm. 1 Introduction Graph algorithms have long been a challenge to programmers of lazy functional languages. It has not been at all clear how to express such algorithms without using side effects to achieve efficiency. For example, many texts provide implementations of search algorithms which are quadratic in the size of the graph (see Paulson (1991), Holyer (1991), or Harrison (1993)), compared with the standard linear im...
An InitialAlgebra Approach to Directed Acyclic Graphs
, 1995
"... . The initialalgebra approach to modelling datatypes consists of giving constructors for building larger objects of that type from smaller ones, and laws identifying di#erentways of constructing the same object. The recursive decomposition of objects of the datatype leads directly to a recursiv ..."
Abstract

Cited by 5 (0 self)
 Add to MetaCart
. The initialalgebra approach to modelling datatypes consists of giving constructors for building larger objects of that type from smaller ones, and laws identifying di#erentways of constructing the same object. The recursive decomposition of objects of the datatype leads directly to a recursive pattern of computation on those objects, whichisvery helpful for both functional and parallel programming. We showhow to model a particular kind of directed acyclic graph using this initialalgebra approach. Keywords. Graphs, data types, catamorphisms, initial algebras, BirdMeertens Formalism, program derivation. 1 Introduction It is now widely recognized that the traditional adhoc approaches to program construction do not yield reliable software; a more systematic and formal approach is required. One such approach consists of program veri#cationproving after the fact that a given program satis#es its formal speci#cation. This approach turns out to be di#cult to implement, not lea...
A Polymorphic Library for Constructive Solid Geometry
, 1994
"... Solid modelling using constructive solid geometry (CSG) includes many examples of stylised divideandconquer algorithms. We identify the sources of these recurrent patterns and implement a Geometric Evaluation Library (GEL) which captures them as higher order functions. This library then become ..."
Abstract

Cited by 4 (3 self)
 Add to MetaCart
Solid modelling using constructive solid geometry (CSG) includes many examples of stylised divideandconquer algorithms. We identify the sources of these recurrent patterns and implement a Geometric Evaluation Library (GEL) which captures them as higher order functions. This library then become the basis of developing CSG applications quickly and concisely. GEL is currently implemented as a set of separately compiled modules in the pure functional language Hope+. We evaluate our work in terms of performance and general applicability. We also assess the benefits of the functional paradigm in this domain and the merits of programming with a set of higher order functions. 1 Introduction We present a case study in functional programming in the field of solid modelling using Constructive Solid Geometry (CSG). It is motivated by the observation that this application domain uses many (potentially parallel) stylised algorithms based on the divideandconquer (D&C) paradigm. Previous...
Dynamic Cyclic Data Structures in Lazy Functional Languages
, 1995
"... Many popular myths have evolved about functional programming languages and their power of expression; one such myth is that "functional languages cannot construct arbitrary cyclic data structures at runtime" and therefore that functional languages are not appropriate for problems which require effi ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
Many popular myths have evolved about functional programming languages and their power of expression; one such myth is that "functional languages cannot construct arbitrary cyclic data structures at runtime" and therefore that functional languages are not appropriate for problems which require efficient representations of dynamicallyspecified cyclic graph structures (such as a routefinding robot in a maze). This myth persists despite ample published work to the contrary (see for example [All89]) and is a recurring subject of debate [USE]. We provide a survey of some of the related work in this area; we then build on this work by presenting methods for both the dynamic construction of complex cyclic structures and their direct manipulation using circular programming techniques. 1 Introduction "A" "B" "C" "D" Figure 1: A small, directed, cyclic graph If one were asked to use a functional language to construct the directed graph given in Figure 1 then the resulting code might typically...
Constructive Solid Geometry Using Algorithmic Skeletons
, 1996
"... This paper presents a study in the use of parallel algorithmic skeletons to program applications of constructive solid geometry (CSG). ..."
Abstract
 Add to MetaCart
This paper presents a study in the use of parallel algorithmic skeletons to program applications of constructive solid geometry (CSG).
Purity, Impurity and Efficiency in Graph Algorithms
"... Introduction This chapter initially considers pure lazy functional languages: their philosophy, advantages and disadvantages. We then examine how to develop efficient lazy functional programs. One way to achieve efficiency is to introduce impurities. In the final section the two schools of lazy fun ..."
Abstract
 Add to MetaCart
Introduction This chapter initially considers pure lazy functional languages: their philosophy, advantages and disadvantages. We then examine how to develop efficient lazy functional programs. One way to achieve efficiency is to introduce impurities. In the final section the two schools of lazy functional programming, pure and impure, are assessed. The assessment centres around two partial implementations of the Hopcroft Tarjan graph planarity algorithm. Profiling tools are used to make an experimental comparison and optimisation of each program. 4.1 Lazy Functional Programming In his book [42] Reade suggests that the user of a traditional imperative language is required to do the following: 1. describe the result to be computed; 2. impose an order on the steps required in the computation; 3. create and destroy, as required, any data structures used by the computation. 74 The first item is concerned with the extensional prope