HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulegraphviz-2999.20.2.0Haskell2010

Data.GraphViz.Commands

This module defines functions to call the various Graphviz commands.

Whilst various output formats are supported (see GraphvizOutput for a complete list), it is not yet possible to choose a desired renderer and formatter. Being able to determine which renderers and formatters are applicable for a specific GraphvizOutput is not easy (there is no listing of available renderers or formatters on the Graphviz website), and for the most part the default ones do the job well.

Please note that for GraphvizOutput and GraphvizCanvas, you will see that they are instances of a GraphvizResult class; this is an internal class that should not be visible outside this module, but Haddock is being too helpful for its own good.

  • 3 types
  • 11 values

The different Graphviz tools available.

4 declarations
datadata GraphvizCommand
#

The available Graphviz commands. The following directions are based upon those in the Graphviz man page (available online at http://graphviz.org/pdf/dot.1.pdf, or if installed on your system man graphviz). Note that any command can be used on both directed and undirected graphs.

When used with the Layout attribute, it overrides any actual command called on the dot graph.

Constructors

  • Dot

    For hierachical graphs (ideal for directed graphs).

  • Neato

    For symmetric layouts of graphs (ideal for undirected graphs).

  • TwoPi

    For radial layout of graphs.

  • Circo

    For circular layout of graphs.

  • Fdp

    Spring-model approach for undirected graphs.

  • Sfdp

    As with Fdp, but ideal for large graphs.

  • Osage

    Filter for drawing clustered graphs, requires Graphviz >= 2.28.0.

  • Patchwork

    Draw clustered graphs as treemaps, requires Graphviz >= 2.28.0.

Instances8Bounded, Enum, Eq, Ord, Read, Show, …

The possible outputs that Graphviz supports.

2 declarations

The list of output types supported by Graphviz is dependent upon how it is built on your system. To determine which actual formats are available on your system, run dot -T?. Trying to use an output type that is not supported by your installation of Graphviz will result in an error.

The outputs defined here in GraphvizOutput and GraphvizCanvas are those from the default list of available outputs. For more information, see: http://graphviz.org/doc/info/output.html

datadata GraphvizOutput
#

The possible Graphviz output formats (that is, those that actually produce a file).

Constructors

  • Bmp

    Windows Bitmap Format.

  • Canon

    Pretty-printed Dot output with no layout performed.

  • DotOutput

    Reproduces the input along with layout information.

  • XDot (Maybe Version)

    As with DotOutput, but provides even more information on how the graph is drawn. The optional Version is the same as specifying the XDotVersion attribute.

  • Eps

    Encapsulated PostScript.

  • Fig

    FIG graphics language.

  • Gd

    Internal GD library format.

  • Gd2

    Compressed version of Gd.

  • Gif

    Graphics Interchange Format.

  • Ico

    Icon image file format.

  • Imap

    Server-side imagemap.

  • Cmapx

    Client-side imagemap.

  • ImapNP

    As for Imap, except only rectangles are used as active areas.

  • CmapxNP

    As for Cmapx, except only rectangles are used as active areas.

  • Jpeg

    The JPEG image format.

  • Pdf

    Portable Document Format.

  • Plain

    Simple text format.

  • PlainExt

    As for Plain, but provides port names on head and tail nodes when applicable.

  • Png

    Portable Network Graphics format.

  • Ps

    PostScript.

  • Ps2

    PostScript for PDF.

  • Svg

    Scalable Vector Graphics format.

  • SvgZ

    Compressed SVG format.

  • Tiff

    Tagged Image File Format.

  • Vml

    Vector Markup Language; Svg is usually preferred.

  • VmlZ

    Compressed VML format; SvgZ is usually preferred.

  • Vrml

    Virtual Reality Modeling Language format; requires nodes to have a third dimension set via the Pos attribute (and with a Dim value of at least 3).

  • WBmp

    Wireless BitMap format; monochrome format usually used for mobile computing devices.

  • WebP

    Google's WebP format; requires Graphviz >= 2.29.0.

Instances5Eq, Ord, Read, Show, GraphvizResult
datadata GraphvizCanvas
#

Unlike GraphvizOutput, these items do not produce an output file; instead, they directly draw a canvas (i.e. a window) with the resulting image.

Instances7Bounded, Enum, Eq, Ord, Read, Show, …

Running Graphviz.

6 declarations
valuegraphvizWithHandle
  1. :: PrintDotRepr dg n
  2. => GraphvizCommand

    Which command to run

  3. -> dg n

    The DotRepr to use

  4. -> GraphvizOutput
  5. -> (Handle -> IO a)

    Extract the output

  6. -> IO a

    The error or the result.

#

Run the chosen Graphviz command on this graph, but send the result to the given handle rather than to a file.

Note that the Handle -> IO a function must fully consume the input from the Handle; e.g. use strict ByteStrings rather than lazy ones.

If the command was unsuccessful, then a GraphvizException is thrown.

Testing if Graphviz is installed

2 declarations

Is the Graphviz suite of tools installed? This is determined by whether dot is available in the PATH.

valuequitWithoutGraphviz :: String -> IO ()
#

If Graphviz does not seem to be available, print the provided error message and then exit fatally.