dotgen-0.4.2: A simple interface for building .dot graph files.

Copyright | Andy Gill
License | BSD3
Maintainer | Andy Gill <andygill@ku.edu>
Stability | unstable
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Text.Dot

Contents

- Dot
- Nodes
- Edges
- Showing a graph
- Other combinators
- Simple netlist generation

Description

This module provides a simple interface for building .dot graph files, for input into the dot and graphviz tools. It includes a monadic interface for building graphs.

Synopsis

- data Dot a
- node :: [(String, String)] -> Dot NodeId
- data NodeId
- userNodeId :: Int -> NodeId
- userNode :: NodeId -> [(String, String)] -> Dot ()
- edge :: NodeId -> NodeId -> [(String, String)] -> Dot ()
- edge' :: NodeId -> Maybe String -> NodeId -> Maybe String -> [(String, String)] -> Dot ()
- (.->.) :: NodeId -> NodeId -> Dot ()
- showDot :: Dot a -> String
- scope :: Dot a -> Dot a
- attribute :: (String, String) -> Dot ()
- share :: [(String, String)] -> [NodeId] -> Dot ()
- same :: [NodeId] -> Dot ()
- cluster :: Dot a -> Dot (NodeId, a)
- netlistGraph :: Ord a => (b -> [(String, String)]) -> (b -> [a]) -> [(a, b)] -> Dot ()

# Dot

data Dot a Source #

Instances

Monad Dot Source # |
Instance details Defined in Text.Dot Methods (>>=) :: Dot a -> (a -> Dot b) -> Dot b Source # (>>) :: Dot a -> Dot b -> Dot b Source # return :: a -> Dot a Source # fail :: String -> Dot a Source #
Functor Dot Source # |
Instance details Defined in Text.Dot Methods fmap :: (a -> b) -> Dot a -> Dot b Source # (<$) :: a -> Dot b -> Dot a Source #
Applicative Dot Source # |
Instance details Defined in Text.Dot Methods pure :: a -> Dot a Source # (<*>) :: Dot (a -> b) -> Dot a -> Dot b Source # liftA2 :: (a -> b -> c) -> Dot a -> Dot b -> Dot c Source # (*>) :: Dot a -> Dot b -> Dot b Source # (<*) :: Dot a -> Dot b -> Dot a Source #

# Nodes

node :: [(String, String)] -> Dot NodeId Source #

`node` takes a list of attributes, generates a new node, and gives a `NodeId`.

data NodeId Source #

Instances

Show NodeId Source # |
Instance details Defined in Text.Dot Methods showsPrec :: Int -> NodeId -> ShowS Source # show :: NodeId -> String Source # showList :: [NodeId] -> ShowS Source #

userNodeId :: Int -> NodeId Source #

`userNodeId` allows a user to use their own (Int-based) node id's, without needing to remap them.

userNode :: NodeId -> [(String, String)] -> Dot () Source #

`userNode` takes a NodeId, and adds some attributes to that node.

# Edges

edge :: NodeId -> NodeId -> [(String, String)] -> Dot () Source #

`edge` generates an edge between two `NodeId`s, with attributes.

edge' :: NodeId -> Maybe String -> NodeId -> Maybe String -> [(String, String)] -> Dot () Source #

`edge` generates an edge between two `NodeId`s, with optional node sub-labels, and attributes.

(.->.) :: NodeId -> NodeId -> Dot () Source #

`.->.` generates an edge between two `NodeId`s.

# Showing a graph

showDot :: Dot a -> String Source #

# Other combinators

scope :: Dot a -> Dot a Source #

`scope` groups a subgraph together; in dot these are the subgraphs inside "{" and "}".

attribute :: (String, String) -> Dot () Source #

`attribute` gives a attribute to the current scope.

share :: [(String, String)] -> [NodeId] -> Dot () Source #

`share` is when a set of nodes share specific attributes. Usually used for layout tweaking.

same :: [NodeId] -> Dot () Source #

`same` provides a combinator for a common pattern; a set of `NodeId`s with the same rank.

cluster :: Dot a -> Dot (NodeId, a) Source #

`cluster` builds an explicit, internally named subgraph (called cluster).

# Simple netlist generation

netlistGraph Source #

Arguments

:: Ord a |
=> (b -> [(String, String)]) | Attributes for each node
-> (b -> [a]) | Out edges leaving each node
-> [(a, b)] | The netlist
-> Dot () |

`netlistGraph` generates a simple graph from a netlist.