Copyright | Andy Gill Simon Meier (extension to record syntax) |
---|---|
License | BSD3 |
Maintainer | Andy Gill <andygill@ku.edu> |
Stability | unstable |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
Text.Dot
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.
- data Dot a
- node :: [(String, String)] -> Dot NodeId
- data NodeId
- userNodeId :: Int -> NodeId
- userNode :: NodeId -> [(String, String)] -> Dot ()
- edge :: NodeId -> NodeId -> [(String, String)] -> Dot ()
- showDot :: Dot a -> String
- scope :: Dot a -> Dot a
- attribute :: (String, String) -> Dot ()
- nodeAttributes :: [(String, String)] -> Dot ()
- edgeAttributes :: [(String, String)] -> Dot ()
- graphAttributes :: [(String, String)] -> Dot ()
- share :: [(String, String)] -> [NodeId] -> Dot ()
- same :: [NodeId] -> Dot ()
- cluster :: Dot a -> Dot (NodeId, a)
- data Record a
- field :: String -> Record a
- portField :: a -> String -> Record a
- hcat :: [Record a] -> Record a
- hcat' :: [String] -> Record a
- vcat :: [Record a] -> Record a
- vcat' :: [String] -> Record a
- record :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)])
- record' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId])
- record_ :: Record a -> [(String, String)] -> Dot NodeId
- mrecord :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)])
- mrecord' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId])
- mrecord_ :: Record a -> [(String, String)] -> Dot NodeId
Dot
Nodes
userNodeId :: Int -> NodeId #
userNodeId
allows a user to use their own (Int-based) node id's, without needing to remap them.
userNode :: NodeId -> [(String, String)] -> Dot () #
userNode
takes a NodeId, and adds some attributes to that node.
Edges
Showing a graph
Other combinators
scope
groups a subgraph together; in dot these are the subgraphs inside "{" and "}".
nodeAttributes :: [(String, String)] -> Dot () #
nodeAttributes
sets attributes for all the following nodes in the scope.
edgeAttributes :: [(String, String)] -> Dot () #
edgeAttributes
sets attributes for all the following edges in the scope.
graphAttributes :: [(String, String)] -> Dot () #
graphAttributes
sets attributes for current graph.
share :: [(String, String)] -> [NodeId] -> Dot () #
share
is when a set of nodes share specific attributes. Usually used for layout tweaking.
cluster :: Dot a -> Dot (NodeId, a) #
cluster
builds an explicit, internally named subgraph (called cluster).
Record specification
Specifies the construction of a record; i.e., mentions all fields possibly together with ports and their horizontal and vertical nesting. (see: record shapes in the DOT documentation.)
portField :: a -> String -> Record a #
A field together with a port which can be used to create direct edges to this field. Note that you can use any type to identify the ports. When creating a record node you will get back an association list between your record identifiers and their concrete node ids.
hcat' :: [String] -> Record a #
Concatenate a list strings interpreted as simple fields horizontally.
Record node construction
record :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)]) #
Create a record node with the given attributes. It returns the node-id of the created node together with an association list mapping the port idenfiers given in the record to their corresponding node-ids. This list is ordered according to a left-to-rigth traversal of the record description.
record' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId]) #
A variant of "record" ignoring the port identifiers.
record_ :: Record a -> [(String, String)] -> Dot NodeId #
A variant of "record" ignoring the port to node-id association list.
mrecord :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)]) #
Like "record", but creates record nodes with rounded corners; i.e. uses the "Mrecord" shape instead of the "record" shape.