Copyright | (c) Alexandre Moine 2019 |
---|---|
Maintainer | alexandre@moine.me |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Tungsten.Structure.Graph
Contents
Description
This module defines a type isomorphic to algebraic graphs (from A. Mokhov, see the
algebraic-graphs package),
in terms of Fix
from Tungsten.Fix.
A good consumer is a function that can be fused with a good producer. A good producer is a function that can be fused with a good consumer.
Synopsis
- data GraphF a b
- newtype Graph a = Graph (Fix (GraphF a))
- empty :: Graph a
- vertex :: a -> Graph a
- overlay :: Graph a -> Graph a -> Graph a
- connect :: Graph a -> Graph a -> Graph a
- foldg :: b -> (a -> b) -> (b -> b -> b) -> (b -> b -> b) -> Graph a -> b
- transpose :: Graph a -> Graph a
- hasVertex :: Eq a => a -> Graph a -> Bool
- vertices :: [a] -> Graph a
- edges :: [(a, a)] -> Graph a
Algebraic graphs as fixed-points
The "factored-out" recursive type for algebraic graphs.
Instances
Show2 GraphF Source # | |
Functor (GraphF a) Source # | |
Show a => Show1 (GraphF a) Source # | |
(Eq a, Eq b) => Eq (GraphF a b) Source # | |
(Ord a, Ord b) => Ord (GraphF a b) Source # | |
Defined in Tungsten.Structure.Graph | |
(Read a, Read b) => Read (GraphF a b) Source # | |
(Show a, Show b) => Show (GraphF a b) Source # | |
Classical operations on graphs
Arguments
:: b | Empty case |
-> (a -> b) | Vertex case |
-> (b -> b -> b) | Overlay case |
-> (b -> b -> b) | Connect case |
-> Graph a | The graph to fold |
-> b |
Fold a graph. Good consumer.