graphviz-2999.20.1.0: Bindings to Graphviz for graph visualisation.

Copyright(c) Matthew Sackman Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Data.GraphViz.Types.Canonical

Contents

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

Documentation

data DotGraph n Source #

A Dot graph in canonical form.

Constructors

DotGraph 

Fields

Instances
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 #

(<$) :: a -> DotGraph b -> DotGraph a #

(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 => DotRepr DotGraph n Source # 
Instance details

Defined in Data.GraphViz.Types

Ord n => FromGeneralisedDot DotGraph n Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

Eq n => Eq (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

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

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

Ord n => Ord (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

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

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

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

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

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

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

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

Read n => Read (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Show n => Show (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

showsPrec :: Int -> DotGraph n -> ShowS #

show :: DotGraph n -> String #

showList :: [DotGraph n] -> ShowS #

ParseDot n => ParseDot (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

PrintDot n => PrintDot (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Sub-components of a DotGraph.

data DotStatements n Source #

Constructors

DotStmts 
Instances
Functor DotStatements Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

fmap :: (a -> b) -> DotStatements a -> DotStatements b #

(<$) :: a -> DotStatements b -> DotStatements a #

Eq n => Eq (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Ord n => Ord (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Read n => Read (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Show n => Show (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

ParseDot n => ParseDot (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

PrintDot n => PrintDot (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

data DotSubGraph n Source #

Instances
Functor DotSubGraph Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Methods

fmap :: (a -> b) -> DotSubGraph a -> DotSubGraph b #

(<$) :: a -> DotSubGraph b -> DotSubGraph a #

Eq n => Eq (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Ord n => Ord (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Read n => Read (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

Show n => Show (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

ParseDot n => ParseDot (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

PrintDot n => PrintDot (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

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 

data GlobalAttributes Source #

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.

Constructors

GraphAttrs 

Fields

NodeAttrs 

Fields

EdgeAttrs 

Fields

Instances
Eq GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Ord GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Read GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Show GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

ParseDot GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

data DotNode n Source #

A node in DotGraph.

Constructors

DotNode 
Instances
Functor DotNode Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

fmap :: (a -> b) -> DotNode a -> DotNode b #

(<$) :: a -> DotNode b -> DotNode a #

Eq n => Eq (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

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

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

Ord n => Ord (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

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

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

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

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

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

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

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

Read n => Read (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Show n => Show (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

showsPrec :: Int -> DotNode n -> ShowS #

show :: DotNode n -> String #

showList :: [DotNode n] -> ShowS #

ParseDot n => ParseDot (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot n => PrintDot (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

data DotEdge n Source #

An edge in DotGraph.

Constructors

DotEdge 

Fields

Instances
Functor DotEdge Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

fmap :: (a -> b) -> DotEdge a -> DotEdge b #

(<$) :: a -> DotEdge b -> DotEdge a #

Eq n => Eq (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

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

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

Ord n => Ord (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

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

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

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

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

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

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

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

Read n => Read (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Show n => Show (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

Methods

showsPrec :: Int -> DotEdge n -> ShowS #

show :: DotEdge n -> String #

showList :: [DotEdge n] -> ShowS #

ParseDot n => ParseDot (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot n => PrintDot (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common