graphviz-2999.20.2.1: Bindings to Graphviz for graph visualisation.

Copyright | (c) Matthew Sackman Ivan Lazar Miljenovic
License | 3-Clause BSD-style
Maintainer | Ivan.Miljenovic@gmail.com
Safe Haskell | None
Language | Haskell2010

Data.GraphViz.Types.Canonical

Contents

- Sub-components of a `DotGraph`.
- Re-exported from `Data.GraphViz.Types`

Description

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.

Synopsis

- data DotGraph n = DotGraph {
  - strictGraph :: Bool
  - directedGraph :: Bool
  - graphID :: Maybe GraphID
  - graphStatements :: DotStatements n
  }
- data DotStatements n = DotStmts {
  - attrStmts :: [GlobalAttributes]
  - subGraphs :: [DotSubGraph n]
  - nodeStmts :: [DotNode n]
  - edgeStmts :: [DotEdge n]
  }
- data DotSubGraph n = DotSG {
  - isCluster :: Bool
  - subGraphID :: Maybe GraphID
  - subGraphStmts :: DotStatements n
  }
- data GraphID
  - = Str Text
  - | Num Number
- data GlobalAttributes
  - = GraphAttrs {
    - attrs :: Attributes
    }
  - | NodeAttrs {
    - attrs :: Attributes
    }
  - | EdgeAttrs {
    - attrs :: Attributes
    }
- data DotNode n = DotNode {
  - nodeID :: n
  - nodeAttributes :: Attributes
  }
- data DotEdge n = DotEdge {
  - fromNode :: n
  - toNode :: n
  - edgeAttributes :: Attributes
  }

# Documentation

data DotGraph n Source #

A Dot graph in canonical form.

Constructors

DotGraph |

Fields

- strictGraph :: Bool

  If `True`, no multiple edges are drawn.

- directedGraph :: Bool
- graphID :: Maybe GraphID
- graphStatements :: DotStatements n

#### Instances

Instances details

Functor DotGraph Source # | Assumed to be an injective mapping function.
Instance details Defined in Data.GraphViz.Types.Canonical Methods fmap :: (a -> b) -> DotGraph a -> DotGraph b Source # (<$) :: a -> DotGraph b -> DotGraph a Source #
Ord n => DotRepr DotGraph n Source # |

Instance details

Defined in Data.GraphViz.Types

Methods

fromCanonical :: DotGraph n -> DotGraph n Source #

getID :: DotGraph n -> Maybe GraphID Source #

setID :: GraphID -> DotGraph n -> DotGraph n Source #

graphIsDirected :: DotGraph n -> Bool Source #

setIsDirected :: Bool -> DotGraph n -> DotGraph n Source #

graphIsStrict :: DotGraph n -> Bool Source #

setStrictness :: Bool -> DotGraph n -> DotGraph n Source #

mapDotGraph :: DotRepr DotGraph n' => (n -> n') -> DotGraph n -> DotGraph n' Source #

graphStructureInformation :: DotGraph n -> (GlobalAttributes, ClusterLookup) Source #

nodeInformation :: Bool -> DotGraph n -> NodeLookup n Source #

edgeInformation :: Bool -> DotGraph n -> [DotEdge n] Source #

unAnonymise :: DotGraph n -> DotGraph n Source #

(Ord n, PrintDot n, ParseDot n) => PPDotRepr DotGraph n Source # |
Instance details Defined in Data.GraphViz.Types
(Ord n, ParseDot n) => ParseDotRepr DotGraph n Source # |
Instance details Defined in Data.GraphViz.Types
(Ord n, PrintDot n) => PrintDotRepr DotGraph n Source # |
Instance details Defined in Data.GraphViz.Types
Ord n => FromGeneralisedDot DotGraph n Source # |
Instance details Defined in Data.GraphViz.Types.Generalised Methods fromGeneralised :: DotGraph n -> DotGraph n Source #
Read n => Read (DotGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods readsPrec :: Int -> ReadS (DotGraph n) Source # readList :: ReadS [DotGraph n] Source # readPrec :: ReadPrec (DotGraph n) Source # readListPrec :: ReadPrec [DotGraph n] Source #
Show n => Show (DotGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods showsPrec :: Int -> DotGraph n -> ShowS Source # show :: DotGraph n -> String Source # showList :: [DotGraph n] -> ShowS Source #
Eq n => Eq (DotGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods (==) :: DotGraph n -> DotGraph n -> Bool Source # (/=) :: DotGraph n -> DotGraph n -> Bool Source #
Ord n => Ord (DotGraph n) Source # |

Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

compare :: DotGraph n -> DotGraph n -> Ordering Source #

(<) :: DotGraph n -> DotGraph n -> Bool Source #

(<=) :: DotGraph n -> DotGraph n -> Bool Source #

(>) :: DotGraph n -> DotGraph n -> Bool Source #

(>=) :: DotGraph n -> DotGraph n -> Bool Source #

max :: DotGraph n -> DotGraph n -> DotGraph n Source #

min :: DotGraph n -> DotGraph n -> DotGraph n Source #

ParseDot n => ParseDot (DotGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods parseUnqt :: Parse (DotGraph n) Source # parse :: Parse (DotGraph n) Source # parseUnqtList :: Parse [DotGraph n] Source # parseList :: Parse [DotGraph n] Source #
PrintDot n => PrintDot (DotGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods unqtDot :: DotGraph n -> DotCode Source # toDot :: DotGraph n -> DotCode Source # unqtListToDot :: [DotGraph n] -> DotCode Source # listToDot :: [DotGraph n] -> DotCode Source #

# Sub-components of a `DotGraph`.

data DotStatements n Source #

Constructors

DotStmts |

Fields

- attrStmts :: [GlobalAttributes]
- subGraphs :: [DotSubGraph n]
- nodeStmts :: [DotNode n]
- edgeStmts :: [DotEdge n]

#### Instances

Instances details

Functor DotStatements Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods fmap :: (a -> b) -> DotStatements a -> DotStatements b Source # (<$) :: a -> DotStatements b -> DotStatements a Source #
Read n => Read (DotStatements n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods readsPrec :: Int -> ReadS (DotStatements n) Source # readList :: ReadS [DotStatements n] Source # readPrec :: ReadPrec (DotStatements n) Source # readListPrec :: ReadPrec [DotStatements n] Source #
Show n => Show (DotStatements n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods showsPrec :: Int -> DotStatements n -> ShowS Source # show :: DotStatements n -> String Source # showList :: [DotStatements n] -> ShowS Source #
Eq n => Eq (DotStatements n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods (==) :: DotStatements n -> DotStatements n -> Bool Source # (/=) :: DotStatements n -> DotStatements n -> Bool Source #
Ord n => Ord (DotStatements n) Source # |

Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

compare :: DotStatements n -> DotStatements n -> Ordering Source #

(<) :: DotStatements n -> DotStatements n -> Bool Source #

(<=) :: DotStatements n -> DotStatements n -> Bool Source #

(>) :: DotStatements n -> DotStatements n -> Bool Source #

(>=) :: DotStatements n -> DotStatements n -> Bool Source #

max :: DotStatements n -> DotStatements n -> DotStatements n Source #

min :: DotStatements n -> DotStatements n -> DotStatements n Source #

ParseDot n => ParseDot (DotStatements n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods parseUnqt :: Parse (DotStatements n) Source # parse :: Parse (DotStatements n) Source # parseUnqtList :: Parse [DotStatements n] Source # parseList :: Parse [DotStatements n] Source #
PrintDot n => PrintDot (DotStatements n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods unqtDot :: DotStatements n -> DotCode Source # toDot :: DotStatements n -> DotCode Source # unqtListToDot :: [DotStatements n] -> DotCode Source # listToDot :: [DotStatements n] -> DotCode Source #

data DotSubGraph n Source #

Constructors

DotSG |

Fields

- isCluster :: Bool
- subGraphID :: Maybe GraphID
- subGraphStmts :: DotStatements n

#### Instances

Instances details

Functor DotSubGraph Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods fmap :: (a -> b) -> DotSubGraph a -> DotSubGraph b Source # (<$) :: a -> DotSubGraph b -> DotSubGraph a Source #
Read n => Read (DotSubGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods readsPrec :: Int -> ReadS (DotSubGraph n) Source # readList :: ReadS [DotSubGraph n] Source # readPrec :: ReadPrec (DotSubGraph n) Source # readListPrec :: ReadPrec [DotSubGraph n] Source #
Show n => Show (DotSubGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods showsPrec :: Int -> DotSubGraph n -> ShowS Source # show :: DotSubGraph n -> String Source # showList :: [DotSubGraph n] -> ShowS Source #
Eq n => Eq (DotSubGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods (==) :: DotSubGraph n -> DotSubGraph n -> Bool Source # (/=) :: DotSubGraph n -> DotSubGraph n -> Bool Source #
Ord n => Ord (DotSubGraph n) Source # |

Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

compare :: DotSubGraph n -> DotSubGraph n -> Ordering Source #

(<) :: DotSubGraph n -> DotSubGraph n -> Bool Source #

(<=) :: DotSubGraph n -> DotSubGraph n -> Bool Source #

(>) :: DotSubGraph n -> DotSubGraph n -> Bool Source #

(>=) :: DotSubGraph n -> DotSubGraph n -> Bool Source #

max :: DotSubGraph n -> DotSubGraph n -> DotSubGraph n Source #

min :: DotSubGraph n -> DotSubGraph n -> DotSubGraph n Source #

ParseDot n => ParseDot (DotSubGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods parseUnqt :: Parse (DotSubGraph n) Source # parse :: Parse (DotSubGraph n) Source # parseUnqtList :: Parse [DotSubGraph n] Source # parseList :: Parse [DotSubGraph n] Source #
PrintDot n => PrintDot (DotSubGraph n) Source # |
Instance details Defined in Data.GraphViz.Types.Canonical Methods unqtDot :: DotSubGraph n -> DotCode Source # toDot :: DotSubGraph n -> DotCode Source # unqtListToDot :: [DotSubGraph n] -> DotCode Source # listToDot :: [DotSubGraph n] -> DotCode Source #

# Re-exported from `Data.GraphViz.Types`

data GraphID Source #

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

Str Text |
Num Number |

#### Instances

Instances details

Read GraphID Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods readsPrec :: Int -> ReadS GraphID Source # readList :: ReadS [GraphID] Source # readPrec :: ReadPrec GraphID Source # readListPrec :: ReadPrec [GraphID] Source #
Show GraphID Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods showsPrec :: Int -> GraphID -> ShowS Source # show :: GraphID -> String Source # showList :: [GraphID] -> ShowS Source #
Eq GraphID Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods (==) :: GraphID -> GraphID -> Bool Source # (/=) :: GraphID -> GraphID -> Bool Source #
Ord GraphID Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods compare :: GraphID -> GraphID -> Ordering Source # (<) :: GraphID -> GraphID -> Bool Source # (<=) :: GraphID -> GraphID -> Bool Source # (>) :: GraphID -> GraphID -> Bool Source # (>=) :: GraphID -> GraphID -> Bool Source # max :: GraphID -> GraphID -> GraphID Source # min :: GraphID -> GraphID -> GraphID Source #
ParseDot GraphID Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods parseUnqt :: Parse GraphID Source # parse :: Parse GraphID Source # parseUnqtList :: Parse [GraphID] Source # parseList :: Parse [GraphID] Source #
PrintDot GraphID Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods unqtDot :: GraphID -> DotCode Source # toDot :: GraphID -> DotCode Source # unqtListToDot :: [GraphID] -> DotCode Source # listToDot :: [GraphID] -> DotCode Source #

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.

Constructors

GraphAttrs |

Fields

- attrs :: Attributes

NodeAttrs |

Fields

- attrs :: Attributes

EdgeAttrs |

Fields

- attrs :: Attributes

#### Instances

Instances details

Read GlobalAttributes Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods readsPrec :: Int -> ReadS GlobalAttributes Source # readList :: ReadS [GlobalAttributes] Source # readPrec :: ReadPrec GlobalAttributes Source # readListPrec :: ReadPrec [GlobalAttributes] Source #
Show GlobalAttributes Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods showsPrec :: Int -> GlobalAttributes -> ShowS Source # show :: GlobalAttributes -> String Source # showList :: [GlobalAttributes] -> ShowS Source #
Eq GlobalAttributes Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods (==) :: GlobalAttributes -> GlobalAttributes -> Bool Source # (/=) :: GlobalAttributes -> GlobalAttributes -> Bool Source #
Ord GlobalAttributes Source # |

Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

compare :: GlobalAttributes -> GlobalAttributes -> Ordering Source #

(<) :: GlobalAttributes -> GlobalAttributes -> Bool Source #

(<=) :: GlobalAttributes -> GlobalAttributes -> Bool Source #

(>) :: GlobalAttributes -> GlobalAttributes -> Bool Source #

(>=) :: GlobalAttributes -> GlobalAttributes -> Bool Source #

max :: GlobalAttributes -> GlobalAttributes -> GlobalAttributes Source #

min :: GlobalAttributes -> GlobalAttributes -> GlobalAttributes Source #

ParseDot GlobalAttributes Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods parseUnqt :: Parse GlobalAttributes Source # parse :: Parse GlobalAttributes Source # parseUnqtList :: Parse [GlobalAttributes] Source # parseList :: Parse [GlobalAttributes] Source #
PrintDot GlobalAttributes Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods unqtDot :: GlobalAttributes -> DotCode Source # toDot :: GlobalAttributes -> DotCode Source # unqtListToDot :: [GlobalAttributes] -> DotCode Source # listToDot :: [GlobalAttributes] -> DotCode Source #

data DotNode n Source #

A node in `DotGraph`.

Constructors

DotNode |

Fields

- nodeID :: n
- nodeAttributes :: Attributes

#### Instances

Instances details

Functor DotNode Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods fmap :: (a -> b) -> DotNode a -> DotNode b Source # (<$) :: a -> DotNode b -> DotNode a Source #
Read n => Read (DotNode n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods readsPrec :: Int -> ReadS (DotNode n) Source # readList :: ReadS [DotNode n] Source # readPrec :: ReadPrec (DotNode n) Source # readListPrec :: ReadPrec [DotNode n] Source #
Show n => Show (DotNode n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods showsPrec :: Int -> DotNode n -> ShowS Source # show :: DotNode n -> String Source # showList :: [DotNode n] -> ShowS Source #
Eq n => Eq (DotNode n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods (==) :: DotNode n -> DotNode n -> Bool Source # (/=) :: DotNode n -> DotNode n -> Bool Source #
Ord n => Ord (DotNode n) Source # |

Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

compare :: DotNode n -> DotNode n -> Ordering Source #

(<) :: DotNode n -> DotNode n -> Bool Source #

(<=) :: DotNode n -> DotNode n -> Bool Source #

(>) :: DotNode n -> DotNode n -> Bool Source #

(>=) :: DotNode n -> DotNode n -> Bool Source #

max :: DotNode n -> DotNode n -> DotNode n Source #

min :: DotNode n -> DotNode n -> DotNode n Source #

ParseDot n => ParseDot (DotNode n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods parseUnqt :: Parse (DotNode n) Source # parse :: Parse (DotNode n) Source # parseUnqtList :: Parse [DotNode n] Source # parseList :: Parse [DotNode n] Source #
PrintDot n => PrintDot (DotNode n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods unqtDot :: DotNode n -> DotCode Source # toDot :: DotNode n -> DotCode Source # unqtListToDot :: [DotNode n] -> DotCode Source # listToDot :: [DotNode n] -> DotCode Source #

data DotEdge n Source #

An edge in `DotGraph`.

Constructors

DotEdge |

Fields

- fromNode :: n
- toNode :: n
- edgeAttributes :: Attributes

#### Instances

Instances details

Functor DotEdge Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods fmap :: (a -> b) -> DotEdge a -> DotEdge b Source # (<$) :: a -> DotEdge b -> DotEdge a Source #
Read n => Read (DotEdge n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods readsPrec :: Int -> ReadS (DotEdge n) Source # readList :: ReadS [DotEdge n] Source # readPrec :: ReadPrec (DotEdge n) Source # readListPrec :: ReadPrec [DotEdge n] Source #
Show n => Show (DotEdge n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods showsPrec :: Int -> DotEdge n -> ShowS Source # show :: DotEdge n -> String Source # showList :: [DotEdge n] -> ShowS Source #
Eq n => Eq (DotEdge n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods (==) :: DotEdge n -> DotEdge n -> Bool Source # (/=) :: DotEdge n -> DotEdge n -> Bool Source #
Ord n => Ord (DotEdge n) Source # |

Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

compare :: DotEdge n -> DotEdge n -> Ordering Source #

(<) :: DotEdge n -> DotEdge n -> Bool Source #

(<=) :: DotEdge n -> DotEdge n -> Bool Source #

(>) :: DotEdge n -> DotEdge n -> Bool Source #

(>=) :: DotEdge n -> DotEdge n -> Bool Source #

max :: DotEdge n -> DotEdge n -> DotEdge n Source #

min :: DotEdge n -> DotEdge n -> DotEdge n Source #

ParseDot n => ParseDot (DotEdge n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods parseUnqt :: Parse (DotEdge n) Source # parse :: Parse (DotEdge n) Source # parseUnqtList :: Parse [DotEdge n] Source # parseList :: Parse [DotEdge n] Source #
PrintDot n => PrintDot (DotEdge n) Source # |
Instance details Defined in Data.GraphViz.Types.Internal.Common Methods unqtDot :: DotEdge n -> DotCode Source # toDot :: DotEdge n -> DotCode Source # unqtListToDot :: [DotEdge n] -> DotCode Source # listToDot :: [DotEdge n] -> DotCode Source #