| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Crem.Graph
Contents
Description
A simple data structure to describe a directed graph
Synopsis
- newtype Graph a = Graph [(a, a)]
- productGraph :: Graph a -> Graph b -> Graph (a, b)
- transitiveClosureGraph :: Eq a => Graph a -> Graph a
- addIdentityEdges :: RenderableVertices a => Graph a -> Graph a
- removeIdentityEdges :: Eq a => Graph a -> Graph a
- data UntypedGraph = forall a.(RenderableVertices a, Eq a, Show a) => UntypedGraph (Graph a)
- untypedProductGraph :: UntypedGraph -> UntypedGraph -> UntypedGraph
- untypedTransitiveClosureGraph :: UntypedGraph -> UntypedGraph
- untypedAddIdentityEdges :: UntypedGraph -> UntypedGraph
- untypedRemoveIdentityEdges :: UntypedGraph -> UntypedGraph
Graph
productGraph :: Graph a -> Graph b -> Graph (a, b) Source #
The product graph.
It has as vertices the product of the set of vertices of the initial graph.
It has as edge from (a1, b1) to (a2, b2) if and only if there is an edge
from a1 to a2 and an edge from b1 to b2
>>>productGraph (Graph [('a', 'b')]) (Graph [('c', 'd')])Graph [(('a','c'),('b','d'))]
transitiveClosureGraph :: Eq a => Graph a -> Graph a Source #
Computes all the possible paths in the input graph and considers them as edges. Notice that the current implementation is removing duplicates
addIdentityEdges :: RenderableVertices a => Graph a -> Graph a Source #
Add all the identity edges to a graph
removeIdentityEdges :: Eq a => Graph a -> Graph a Source #
Remove all the edges which start and end at the same vertex
UntypedGraph
data UntypedGraph Source #
A data type to represent a graph which is not tracking the vertex type
Constructors
| forall a.(RenderableVertices a, Eq a, Show a) => UntypedGraph (Graph a) |
Instances
| Show UntypedGraph Source # | |
Defined in Crem.Graph Methods showsPrec :: Int -> UntypedGraph -> ShowS # show :: UntypedGraph -> String # showList :: [UntypedGraph] -> ShowS # | |
untypedProductGraph :: UntypedGraph -> UntypedGraph -> UntypedGraph Source #
Same as productGraph but for UntypedGraph
untypedTransitiveClosureGraph :: UntypedGraph -> UntypedGraph Source #
Same as transitiveClosureGraph but for UntypedGraph
untypedAddIdentityEdges :: UntypedGraph -> UntypedGraph Source #
Add all identity edges to an UntypedGraph
untypedRemoveIdentityEdges :: UntypedGraph -> UntypedGraph Source #
Remove all the edges which start and end at the same vertex from an
UntypedGraph