The core type class for constructing algebraic graphs, characterised by the
following minimal set of axioms. In equations we use + and * as convenient
shortcuts for overlay and connect, respectively.
overlay is commutative and associative:
x + y == y + x x + (y + z) == (x + y) + zconnect is associative and has empty as the identity:
x * empty == x empty * x == x x * (y * z) == (x * y) * zconnect distributes over overlay:
x * (y + z) == x * y + x * z (x + y) * z == x * z + y * zconnect can be decomposed:
x * y * z == x * y + x * z + y * z
The following useful theorems can be proved from the above set of axioms.
overlay has empty as the identity and is idempotent:
x + empty == x empty + x == x x + x == xAbsorption and saturation of connect:
x * y + x + y == x * y x * x * x == x * x
The core type class Graph corresponds to unlabelled directed graphs. Undirected, Reflexive, Transitive and Preorder graphs can be obtained by extending the minimal set of axioms.
When specifying the time and memory complexity of graph algorithms, n will denote the number of vertices in the graph, m will denote the number of edges in the graph, and s will denote the size of the corresponding Graph expression.
Associated types
type family Vertex gThe type of graph vertices.
Instances17Graph, …
Graph AdjacencyIntMapDefined in algebraic-graphs-0.8 · Algebra.Graph.ClassGraph ()Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassGraph (Graph a)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassGraph (Graph a)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassGraph g => Graph (Maybe g)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassOrd a => Graph (AdjacencyMap a)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassOrd a => Graph (Todo a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Example.TodoOrd a => Graph (Relation a)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassOrd a => Graph (PreorderRelation a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Relation.PreorderOrd a => Graph (ReflexiveRelation a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Relation.ReflexiveOrd a => Graph (Relation a)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassOrd a => Graph (TransitiveRelation a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Relation.TransitiveGraph g => Graph (a -> g)Defined in algebraic-graphs-0.8 · Algebra.Graph.ClassDioid e => Graph (Graph e a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Class(Graph g, Graph h) => Graph (g, h)Defined in algebraic-graphs-0.8 · Algebra.Graph.Class(Dioid e, Eq e, Ord a) => Graph (AdjacencyMap e a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Class(Graph g, Graph h, Graph i) => Graph (g, h, i)Defined in algebraic-graphs-0.8 · Algebra.Graph.Class