BSD-3-Clause licensed by Henning Thielemann
Maintained by [email protected]
This version can be pinned in stack with:comfort-graph-0.0.4@sha256:3cf712f73687c73afcb768d9d6e733272a559578490cef36da0d7454ca2d7352,3674

Module documentation for 0.0.4

This graph structure is based on Data.Map and allows any Ord type for nodes and allows directed, undirected and more edge types. There is no need to map nodes to integer numbers. This makes handling in applications much more comfortable, thus the package name. This is especially useful for applications where there is no simple mapping of your node identifiers to integers or where the set of nodes is extended or reduced frequently. However, this flexibility comes with some costs. Since the structure is based on Data.Map.Maps, for efficient computing the node type should support fast comparison.

The edge type can be freely chosen. This allows great flexibility but it is a bit more cumbersome to do in Haskell 98. Examples of edge types:

  • DirEdge: Edges in a directed graph

  • UndirEdge: Edges in an undirected graph

  • EitherEdge: For graphs containing both directed and undirected edges

  • You may define an edge type with an additional identifier in order to support multiple edges between the same pair of nodes.

  • Using type functions with the node type as parameter you may even define an edge type for nodes from a Cartesian product, where only "horizontal" and "vertical" edges are allowed.

For examples see the linear-circuit package and its tests. The ResistorCube test demonstrates non-integer node types and the Tree test demonstrates multigraphs. Another application is cabal-sort.

Currently the package does not contain any advanced algorithm, just the data structure and some manipulation functions.

The package is plain Haskell 98.

Related packages:

  • fgl: standard package for graph processing with many graph algorithms but cumbersome data structure with Int numbered nodes