graphviz-2009.5.1: GraphViz wrapper for Haskell.



This is the top-level module for the graphviz library. It provides functions to convert Graphs into the Dot language used by the GraphViz program (as well as a limited ability to perform the reverse operation).

Information about GraphViz and the Dot language can be found at:

Note that this module re-exports the Data.GraphViz.Attributes module, which exports a constructor that clashes with LT. As such, you may need to import either this module or the Prelude qualified or hiding LT.



graphToDot :: (Ord b, Graph gr) => gr a b -> [Attribute] -> (LNode a -> [Attribute]) -> (LEdge b -> [Attribute]) -> DotGraphSource

Convert a graph to GraphViz's Dot format.

clusterGraphToDot :: (Ord c, Ord b, Graph gr) => gr a b -> [Attribute] -> (LNode a -> NodeCluster c a) -> (c -> [Attribute]) -> (LNode a -> [Attribute]) -> (LEdge b -> [Attribute]) -> DotGraphSource

Convert a graph to Dot format, using the specified clustering function to group nodes into clusters. Clusters can be nested to arbitrary depth.

graphToGraph :: forall gr a b. (Ord b, Graph gr) => gr a b -> [Attribute] -> (LNode a -> [Attribute]) -> (LEdge b -> [Attribute]) -> IO (gr (AttributeNode a) (AttributeEdge b))Source

Run the graph via dot to get positional information and then combine that information back into the original graph. Note that this doesn't support graphs with clusters.

dotizeGraph :: (DynGraph gr, Ord b) => gr a b -> gr (AttributeNode a) (AttributeEdge b)Source

Pass the plain graph through graphToGraph. This is an IO action, however since the state doesn't change it's safe to use unsafePerformIO to convert this to a normal function.

data NodeCluster c a Source

Define into which cluster a particular node belongs. Nodes can be nested to arbitrary depth.


N (LNode a) 
C c (NodeCluster c a) 


(Show c, Show a) => Show (NodeCluster c a)