comfort-graph: Graph structure with type parameters for nodes and edges
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.Map
s,
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 graphUndirEdge
: Edges in an undirected graphEitherEdge
: For graphs containing both directed and undirected edgesYou 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
Downloads
- comfort-graph-0.0.4.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 0.0, 0.0.0.1, 0.0.0.2, 0.0.0.3, 0.0.1, 0.0.2, 0.0.2.1, 0.0.3, 0.0.3.1, 0.0.3.2, 0.0.3.3, 0.0.4 |
---|---|
Dependencies | base (>=4.5 && <5), containers (>=0.5.8 && <0.8), QuickCheck (>=2.5 && <3), semigroups (>=0.1 && <1.0), transformers (>=0.5 && <0.7), utility-ht (>=0.0.10 && <0.1) [details] |
License | BSD-3-Clause |
Author | Henning Thielemann |
Maintainer | haskell@henning-thielemann.de |
Revised | Revision 1 made by HenningThielemann at 2023-10-07T14:36:52Z |
Category | Data |
Home page | https://hub.darcs.net/thielema/comfort-graph |
Source repo | this: darcs get https://hub.darcs.net/thielema/comfort-graph --tag 0.0.4 head: darcs get https://hub.darcs.net/thielema/comfort-graph |
Uploaded | by HenningThielemann at 2023-09-29T18:38:54Z |
Distributions | LTSHaskell:0.0.4, NixOS:0.0.4, Stackage:0.0.4 |
Reverse Dependencies | 1 direct, 1 indirect [details] |
Downloads | 6815 total (58 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2023-09-29 [all 1 reports] |