Maintainer | Ivan.Miljenovic@gmail.com |
---|---|

Safe Haskell | Safe-Infered |

This module is based upon the *dotgen* library by Andy Gill:
http://hackage.haskell.org/package/dotgen

It provides a monadic interface for constructing generalised Dot
graphs. Note that this does *not* have an instance for `DotRepr`

(e.g. what would be the point of the `fromCanonical`

function, as
you can't do anything with the result): it is purely for
construction purposes. Use the generalised Dot graph instance for
printing, etc.

Note that the generalised Dot graph types are *not* re-exported, in
case it causes a clash with other modules you may choose to import.

The example graph in Data.GraphViz.Types can be written as:

digraph (Str "G") $ do cluster (Int 0) $ do graphAttrs [style filled, color LightGray] nodeAttrs [style filled, color White] "a0" --> "a1" "a1" --> "a2" "a2" --> "a3" graphAttrs [textLabel "process #1"] cluster (Int 1) $ do nodeAttrs [style filled] "b0" --> "b1" "b1" --> "b2" "b2" --> "b3" graphAttrs [textLabel "process #2", color Blue] "start" --> "a0" "start" --> "b0" "a1" --> "b3" "b2" --> "a3" "a3" --> "end" "b3" --> "end" node "start" [shape MDiamond] node "end" [shape MSquare]

- type Dot n = DotM n ()
- data DotM n a
- data GraphID
- digraph :: GraphID -> DotM n a -> DotGraph n
- digraph' :: DotM n a -> DotGraph n
- graph :: GraphID -> DotM n a -> DotGraph n
- graph' :: DotM n a -> DotGraph n
- graphAttrs :: Attributes -> Dot n
- nodeAttrs :: Attributes -> Dot n
- edgeAttrs :: Attributes -> Dot n
- cluster :: GraphID -> DotM n a -> Dot n
- node :: n -> Attributes -> Dot n
- node' :: n -> Dot n
- edge :: n -> n -> Attributes -> Dot n
- (-->) :: n -> n -> Dot n
- (<->) :: n -> n -> Dot n

# Documentation

The actual monad; as with `Dot`

but allows you to return a value
within the do-block. The actual implementation is based upon the
Writer monad.

# Creating a generalised DotGraph.

digraph :: GraphID -> DotM n a -> DotGraph nSource

Create a directed dot graph with the specified graph ID.

graph :: GraphID -> DotM n a -> DotGraph nSource

Create a undirected dot graph with the specified graph ID.

# Adding global attributes.

graphAttrs :: Attributes -> Dot nSource

Add graph*sub-graph*cluster attributes.

nodeAttrs :: Attributes -> Dot nSource

Add global node attributes.

edgeAttrs :: Attributes -> Dot nSource

Add global edge attributes

# Adding items to the graph.

## Clusters

## Nodes

node :: n -> Attributes -> Dot nSource

Add a node to the graph.

## Edges

edge :: n -> n -> Attributes -> Dot nSource

Add an edge to the graph.