Copyright | (c) Matthew Sackman Ivan Lazar Miljenovic |
---|---|
License | 3-Clause BSD-style |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
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.
- data DotGraph n = DotGraph {}
- data DotStatements n = DotStmts {
- attrStmts :: [GlobalAttributes]
- subGraphs :: [DotSubGraph n]
- nodeStmts :: [DotNode n]
- edgeStmts :: [DotEdge n]
- data DotSubGraph n = DotSG {}
- data GraphID
- data GlobalAttributes
- = GraphAttrs {
- attrs :: Attributes
- | NodeAttrs {
- attrs :: Attributes
- | EdgeAttrs {
- attrs :: Attributes
- = GraphAttrs {
- data DotNode n = DotNode {
- nodeID :: n
- nodeAttributes :: Attributes
- data DotEdge n = DotEdge {
- fromNode :: n
- toNode :: n
- edgeAttributes :: Attributes
Documentation
A Dot graph in canonical form.
DotGraph | |
|
Functor DotGraph Source # | Assumed to be an injective mapping function. |
(Ord n, PrintDot n, ParseDot n) => PPDotRepr DotGraph n Source # | |
(Ord n, ParseDot n) => ParseDotRepr DotGraph n Source # | |
(Ord n, PrintDot n) => PrintDotRepr DotGraph n Source # | |
Ord n => DotRepr DotGraph n Source # | |
Ord n => FromGeneralisedDot DotGraph n Source # | |
Eq n => Eq (DotGraph n) Source # | |
Ord n => Ord (DotGraph n) Source # | |
Read n => Read (DotGraph n) Source # | |
Show n => Show (DotGraph n) Source # | |
ParseDot n => ParseDot (DotGraph n) Source # | |
PrintDot n => PrintDot (DotGraph n) Source # | |
Sub-components of a DotGraph
.
data DotStatements n Source #
DotStmts | |
|
Functor DotStatements Source # | |
Eq n => Eq (DotStatements n) Source # | |
Ord n => Ord (DotStatements n) Source # | |
Read n => Read (DotStatements n) Source # | |
Show n => Show (DotStatements n) Source # | |
ParseDot n => ParseDot (DotStatements n) Source # | |
PrintDot n => PrintDot (DotStatements n) Source # | |
data DotSubGraph n Source #
DotSG | |
|
Functor DotSubGraph Source # | |
Eq n => Eq (DotSubGraph n) Source # | |
Ord n => Ord (DotSubGraph n) Source # | |
Read n => Read (DotSubGraph n) Source # | |
Show n => Show (DotSubGraph n) Source # | |
ParseDot n => ParseDot (DotSubGraph n) Source # | |
PrintDot n => PrintDot (DotSubGraph n) Source # | |
Re-exported from Data.GraphViz.Types
data GlobalAttributes Source #
Represents a list of top-level list of Attribute
s for the
entire graph/sub-graph. Note that GraphAttrs
also applies to
DotSubGraph
s.
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.
A node in DotGraph
.
DotNode | |
|
An edge in DotGraph
.
DotEdge | |
|