The AdjacencyMap data type represents an acyclic graph by a map of vertices to their adjacency sets. Although the internal representation allows for cycles, the methods provided by this module cannot be used to construct a graph with cycles.
The Show instance is defined using basic graph construction primitives where possible, falling back to toAcyclic and Algebra.Graph.AdjacencyMap otherwise:
show empty == "empty"
show (shrink 1) == "vertex 1"
show (shrink $ 1 + 2) == "vertices [1,2]"
show (shrink $ 1 * 2) == "(fromJust . toAcyclic) (edge 1 2)"
show (shrink $ 1 * 2 * 3) == "(fromJust . toAcyclic) (edges [(1,2),(1,3),(2,3)])"
show (shrink $ 1 * 2 + 3) == "(fromJust . toAcyclic) (overlay (vertex 3) (edge 1 2))"
The total order on graphs is defined using size-lexicographic comparison:
Compare the number of vertices. In case of a tie, continue.
Compare the sets of vertices. In case of a tie, continue.
Compare the number of edges. In case of a tie, continue.
Compare the sets of edges.
Note that the resulting order refines the isSubgraphOf relation:
isSubgraphOf x y ==> x <= yInstances3Eq, Ord, Show
Eq a => Eq (AdjacencyMap a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Acyclic.AdjacencyMapOrd a => Ord (AdjacencyMap a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Acyclic.AdjacencyMap(Ord a, Show a) => Show (AdjacencyMap a)Defined in algebraic-graphs-0.8 · Algebra.Graph.Acyclic.AdjacencyMap