HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulegraphviz-2999.20.2.0Haskell2010

Data.GraphViz.Types.Canonical

A canonical Dot graph requires that within each graph/sub-graph, the statements are in the following order:

  • global attributes

  • sub-graphs/clusters

  • nodes

  • edges

This Dot graph representation is ideally suited for converting other data structures to Dot form (especially with the help of graphElemsToDot from Data.GraphViz).

If you require arbitrary ordering of statements, then use Data.GraphViz.Types.Generalised.

The sample graph could be implemented (this is actually the result of calling canonicalise from Data.GraphViz.Algorithms on the generalised one) as:

DotGraph { strictGraph = False
         , directedGraph = True
         , graphID = Just (Str "G")
         , graphStatements = DotStmts { attrStmts = []
                                      , subGraphs = [ DotSG { isCluster = True
                                                            , subGraphID = Just (Num (Int 0))
                                                            , subGraphStmts = DotStmts { attrStmts = [ GraphAttrs [ style filled
                                                                                                                  , color LightGray
                                                                                                                  , textLabel "process #1"]
                                                                                                     , NodeAttrs [style filled, color White]]
                                                                                       , subGraphs = []
                                                                                       , nodeStmts = [ DotNode "a0" []
                                                                                                     , DotNode "a1" []
                                                                                                     , DotNode "a2" []
                                                                                                     , DotNode "a3" []]
                                                                                       , edgeStmts = [ DotEdge "a0" "a1" []
                                                                                                     , DotEdge "a1" "a2" []
                                                                                                     , DotEdge "a2" "a3" []
                                                                                                     , DotEdge "a3" "a0" []]}}
                                                    , DotSG { isCluster = True
                                                            , subGraphID = Just (Num (Int 1))
                                                            , subGraphStmts = DotStmts { attrStmts = [ GraphAttrs [textLabel "process #2", color Blue]
                                                                                                     , NodeAttrs [style filled]]
                                                                                       , subGraphs = []
                                                                                       , nodeStmts = [ DotNode "b0" []
                                                                                                     , DotNode "b1" []
                                                                                                     , DotNode "b2" []
                                                                                                     , DotNode "b3" []]
                                                                                       , edgeStmts = [ DotEdge "b0" "b1" []
                                                                                                     , DotEdge "b1" "b2" []
                                                                                                     , DotEdge "b2" "b3" []]}}]
                                      , nodeStmts = [ DotNode "end" [shape MSquare]
                                                    , DotNode "start" [shape MDiamond]]
                                      , edgeStmts = [ DotEdge "start" "a0" []
                                                    , DotEdge "start" "b0" []
                                                    , DotEdge "a1" "b3" []
                                                    , DotEdge "b2" "a3" []
                                                    , DotEdge "a3" "end" []
                                                    , DotEdge "b3" "end" []]}}

Note that whilst the above graph represents the same Dot graph as specified in Data.GraphViz.Types.Generalised, etc., it may be drawn slightly differently by the various Graphviz tools.

  • 7 types
datadata DotGraph n
#

A Dot graph in canonical form.

Constructors

Instances12Functor, DotRepr, PPDotRepr, ParseDotRepr, PrintDotRepr, FromGeneralisedDot, …

Sub-components of a DotGraph.

2 declarations
datadata DotStatements n
#
Instances7Functor, Eq, Ord, Read, Show, ParseDot, …
datadata DotSubGraph n
#
Instances7Functor, Eq, Ord, Read, Show, ParseDot, …

Re-exported from Data.GraphViz.Types

4 declarations
datadata GraphID
#

A polymorphic type that covers all possible ID values allowed by Dot syntax. Note that whilst the ParseDot and PrintDot instances for String will properly take care of the special cases for numbers, they are treated differently here.

Constructors

Instances6Eq, Ord, Read, Show, ParseDot, PrintDot
  • Eq GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Ord GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Read GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Show GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
datadata GlobalAttributes
#

Represents a list of top-level list of Attributes for the entire graph/sub-graph. Note that GraphAttrs also applies to DotSubGraphs.

Note that Dot allows a single Attribute to be listed on a line; if this is the case then when parsing, the type of Attribute it is determined and that type of GlobalAttribute is created.

Instances6Eq, Ord, Read, Show, ParseDot, PrintDot
datadata DotNode n
#

A node in DotGraph.

Instances7Functor, Eq, Ord, Read, Show, ParseDot, …
  • Functor DotNodeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Eq n => Eq (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Ord n => Ord (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Read n => Read (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Show n => Show (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot n => ParseDot (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot n => PrintDot (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
datadata DotEdge n
#

An edge in DotGraph.

Instances7Functor, Eq, Ord, Read, Show, ParseDot, …
  • Functor DotEdgeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Eq n => Eq (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Ord n => Ord (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Read n => Read (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Show n => Show (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot n => ParseDot (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot n => PrintDot (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common