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 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 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.
Cite
CITATION STYLE
Erwig, M. (1997). Functional Programming with Graphs. SIGPLAN Notices (ACM Special Interest Group on Programming Languages), 32(8), 52–74. https://doi.org/10.1145/258949.258955
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.