Copyright | (c) Ivan Lazar Miljenovic |
---|---|
License | 3-Clause BSD-style |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
The generalised Dot representation most closely matches the implementation of actual Dot code, as it places no restrictions on ordering of elements, etc. As such it should be able to parse any existing Dot code (taking into account the parsing limitations/assumptions).
The sample graph could be implemented (this is actually a prettied version of parsing in the Dot code) as:
DotGraph { strictGraph = False , directedGraph = True , graphID = Just (Str "G") , graphStatements = Seq.fromList [ SG $ DotSG { isCluster = True , subGraphID = Just (Int 0) , subGraphStmts = Seq.fromList [ GA $ GraphAttrs [style filled] , GA $ GraphAttrs [color LightGray] , GA $ NodeAttrs [style filled, color White] , DE $ DotEdge "a0" "a1" [] , DE $ DotEdge "a1" "a2" [] , DE $ DotEdge "a2" "a3" [] , GA $ GraphAttrs [textLabel "process #1"]]} , SG $ DotSG { isCluster = True , subGraphID = Just (Int 1) , subGraphStmts = fromList [ GA $ NodeAttrs [style filled] , DE $ DotEdge "b0" "b1" [] , DE $ DotEdge "b1" "b2" [] , DE $ DotEdge "b2" "b3" [] , GA $ GraphAttrs [textLabel "process #2"] , GA $ GraphAttrs [color Blue]]} , DE $ DotEdge "start" "a0" [] , DE $ DotEdge "start" "b0" [] , DE $ DotEdge "a1" "b3" [] , DE $ DotEdge "b2" "a3" [] , DE $ DotEdge "a3" "a0" [] , DE $ DotEdge "a3" "end" [] , DE $ DotEdge "b3" "end" [] , DN $ DotNode "start" [shape MDiamond] , DN $ DotNode "end" [shape MSquare]]}
- data DotGraph n = DotGraph {}
- class DotRepr dg n => FromGeneralisedDot dg n where
- type DotStatements n = Seq (DotStatement n)
- data DotStatement n
- = GA GlobalAttributes
- | SG (DotSubGraph n)
- | DN (DotNode n)
- | DE (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
The internal representation of a generalised graph in Dot 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 # | |
class DotRepr dg n => FromGeneralisedDot dg n where Source #
This class is useful for being able to parse in a dot graph as a generalised one, and then convert it to your preferred representation.
This can be seen as a semi-inverse of fromCanonical
.
fromGeneralised :: DotGraph n -> dg n Source #
Ord n => FromGeneralisedDot DotGraph n Source # | |
Ord n => FromGeneralisedDot DotGraph n Source # | |
Ord n => FromGeneralisedDot DotGraph n Source # | |
Sub-components of a DotGraph
.
type DotStatements n = Seq (DotStatement n) Source #
data DotStatement n Source #
GA GlobalAttributes | |
SG (DotSubGraph n) | |
DN (DotNode n) | |
DE (DotEdge n) |
Functor DotStatement Source # | |
Eq n => Eq (DotStatement n) Source # | |
Ord n => Ord (DotStatement n) Source # | |
Read n => Read (DotStatement n) Source # | |
Show n => Show (DotStatement n) Source # | |
ParseDot n => ParseDot (DotStatement n) Source # | |
PrintDot n => PrintDot (DotStatement 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 | |
|