graphviz

Bindings to Graphviz for graph visualisation.

http://projects.haskell.org/graphviz/

Version on this page:2999.17.0.2@rev:2
LTS Haskell 23.21:2999.20.2.1
Stackage Nightly 2025-05-03:2999.20.2.1
Latest on Hackage:2999.20.2.1

See all snapshots graphviz appears in

BSD-3-Clause licensed by Matthew Sackman, Ivan Lazar Miljenovic
Maintained by [email protected]
This version can be pinned in stack with:graphviz-2999.17.0.2@sha256:16c98abf1ba333abd705259794da84d31b1f052ff989b176b829d2ee9c426abf,7398

% Haskell bindings to the Graphviz toolkit % Ivan Lazar Miljenovic

The graphviz Library

The graphviz library provides bindings to the Graphviz graph visualisation suite of tools for the purely functional programming language Haskell. It can be downloaded from HackageDB or - if you have cabal-install - installing it is as simple as:

cabal update
cabal install graphviz

Library features

Main features of the graphviz library include:

  • Almost complete coverage of all Graphviz attributes and syntax.

  • Support for specifying clusters.

  • The ability to use a custom node type.

  • Functions for running a Graphviz layout tool with all specified output types.

  • The ability to not only generate but also parse Dot code with two options: strict and liberal (in terms of ordering of statements).

  • Functions to convert FGL graphs and other graph-like data structures to Dot code - including support to group them into clusters - with a high degree of customisation by specifying which attributes to use and limited support for the inverse operation.

  • Round-trip support for passing an FGL graph through Graphviz to augment node and edge labels with positional information, etc.

graphviz is free software licensed under a 3-Clause BSD License.

(C) 2008 Matthew Sackman

(C) 2008 - onwards Ivan Lazar Miljenovic

For more information, feel free to email me.

Changes

% Changelog % Ivan Lazar Miljenovic

Release History and Changelog

The following is information about what major changes have gone into each release.

Changes in 2999.17.0.1

  • Allow usage of transformers-0.4.*, by Sergei Trofimovich.

Changes in 2999.17.0.0

  • Add support for Graphviz 2.32.0, 2.32.1, 2.34.0, 2.36.0 and 2.38.0:

    • WARNING: at least as of Graphviz-2.32.0, dot -Tcanon no longer produces Dot code that is in the format expected by the Canonical Dot representation in this library. As such, unless you’re very sure of your sources you should always use the Generalised representation for parsing (see also the new FromGeneralisedDot class mentioned below).

    • New attributes:

      • XDotVersion (as of 2.34.0)

      • InputScale (as of 2.36.0)

      • OverlapShrink (as of 2.36.0)

    • Changed attributes:

      • Aspect no longer available (as of 2.36.0)

      • New ModeType values for use with sfdp: SpringMode and MaxEnt.

      • Weight now takes a value of type Number, that explicitly distinguishes between Doubles and Ints.

      • FixedSize and Normalize now have their own types.

      • New Shapes: Star and Underline (as well as Square which seems to have been omitted from previous versions).

    • Other relevant changes:

      • XDot now takes an optional version. Note that this doesn’t have any effect on how graphviz works.

      • The default extension for Dot-graphs is now .gv rather than .dot to reflect Graphviz’s changed conventions.

  • Other changes to the API:

    • Add the FromGeneralisedDot class, which provides a semi-inverse to fromCanonical in DotRepr.

    • GraphID now uses Number rather than separate Int and Double constructors; this only matters if you manually constructed or de-constructed GraphID values (ToGraphID still works).

    • Add the ability to parse a Dot graph “liberally”: that is, if an Attribute doesn’t match the specification, then let it fall back to an UnknownAttribute. This is still experimental, and requires more manual usage than the in-built commands (e.g. it isn’t supported in the default round-tripping).

    • Now using the definition of bracket from polyparse >= 1.9.

    • Monadic representation now has Functor and Applicative instances to satisfy the up-coming changes in GHC 7.10.

  • Compilation time has been reduced in two ways:

    • The Data.GraphViz.Attributes.Complete module has been split up (but still exports the same API, so no need to import more modules). Whilst I haven’t measured it, this should also reduce memory requirements for compilation.

    • The testsuite now uses the library explicitly, and thus no longer needs to re-compile half the library.

  • Bug-fixes:

    • Double values are now longer parseable without double quotes if they have an exponential term (to better match the definition).

    • It is no longer assumed when round-tripping that dot -Tdot generates canonicalised Dot graphs.

  • The TestParsing script is now directly buildable by Cabal using the test-parsing flag (the resulting executable is called graphviz-testparsing). This is not made an actual test-suite as not all files found will be actual Dot graphs, and it’s known that it fails on some. Instead it’s meant to be used as an indication of how well this library parses “real-world” Dot code.

Changes in 2999.16.0.0

  • Add support for Graphviz-2.30.0:

    • New attributes:

      • Area
      • Head_LP
      • LayerListSep
      • LayerSelect
      • Tail_LP
      • XLP
    • BgColor, Color and FillColor now take a list of colors with optional weightings.

    • Layer handling now supports layer sub-ranges.

    • Added the voronoi-based option to Overlap.

    • Added the Striped and Wedged styles.

  • Updates to attributes and their values:

    • The following attributes have had their values changed to better reflect what they represent:

      • FontPath takes a Path value.

      • Layout takes a GraphvizCommand (and thus GraphvizCommand has been moved to Data.GraphViz.Attributes.Complete).

    • Added MDS to Model (which had somehow been overlooked).

    • Various attributes now have defaults added/updated/removed if wrong.

    • Removed the following deprecated attributes:

      • ShapeFile

      • Z

  • Now any value that has a defined default can be parsed when the Dot code just has attribute="" (which dot -Tcanon is fond of doing to “reset” attributes).

  • GraphvizCommand now defines Sfdp (which had somehow been overlooked up till now).

  • The canonicalise and related functions have been re-written; whilst there might be some cases where their behaviour does not fully match how dot -Tcanon and tred behave (due to the interaction of various attributes), the new implementation is much more sane.

  • Use temporary files rather than pipes when running dot, etc.

    Makes it more portable, and also avoids issues where dot, etc. use 100% CPU when a graph is passed in via stdin.

    Original patch by Henning Thielemann.

  • renderCompactDot now outputs to just one line (which means it’s shorter, but more difficult to read for a human).

  • The QuickCheck instances are a bit smarter now to avoid having such ugly huge outputs when a test fails.

  • More documentation to help you understand what certain data types are for, etc.

Changes in 2999.15.0.1

  • Fixed bug where canonicalise and related functions did not properly deal with attributes of a single node or edge within a sub-graph.

Changes in 2999.15.0.0

  • The repository is now hosted on hub.darcs.net, and using the bug-tracker there.

  • Updates to various Attribute definitions:

    • The list of available shapes has been expanded to take into account the new synthetic biology shapes.

    • The Size and FontNames attributes now have specified data types.

    • The optional start and end points for Splines were previously the wrong way round; this has now been fixed.

    • Explicitly only print 2-dimensional Point values for Rect and DPoint (previously only 2-dimensional values where parsed, but it was possible to print a 3-dimensional value).

    • HTML-like labels previously disallowed empty textual label components when parsing; spotted by Daniel Hummel.

  • GraphvizParams now lets you specify whether a “cluster” is actually a cluster or a sub-graph. Requested by Gabor Greif.

  • Fixed an error where printing edges whose attributes contained a ColorScheme attribute, that attribute would stay in the state and the old color scheme would override the parent’s state.

  • Previously, some malformed attributes were accepted when being parsed as they silently became parsed as an UnknownAttribute. Now, attributes where the attribute name and the equal sign are successfully parsed but the value of the attribute is not successfully parse will throw an unrecoverable error.

    Note: this does mean that some Dot graphs that are accepted by Graphviz (as they separate tokenizing from parsing; as such something like "0.1" is successfully accepted as an integer, specifically 0) are no longer accepted when parsing them in.

  • Miscellaneous parsing improvements:

    • Whilst not specified anywhere, Graphviz seems to treat empty quotes as values for attributes expecting a number as their default; as such, this is now taken into account when parsing.

    • DPoint values can now parse an optional + prefix.

    • Whitespaces after commas in HSV colors are now accepted.

  • Error messages from parsing are improved to help you track down where the parsing error occurred (in that it’s easier to find which attribute failed to parse, etc.).

  • Some parsing combinators are no longer publicly accessible, but shouldn’t be needed by end users anyway (as they were there for parsing the Attribute data type).

Changes in 2999.14.1.0

  • Add isGraphvizInstalled and quitWithoutGraphviz for programs to test whether Graphviz has been installed (as previous attempts at doing so via actual calls to dot, neato, etc. weren’t working and would be too verbose anyway).

Changes in 2999.14.0.0

  • Added an instance of Labellable for strict Text values, as requested by Erik Rantapaa.

Changes in 2999.13.0.3

  • Allow usage of transformers-0.3.*. Spotted by Peter Simons.

Changes in 2999.13.0.2

  • The String instance for ToGraphID requires the TypeSynonymInstances pragma (at least on GHC < 7.4). Spotted by Gregory Guthrie.

Changes in 2999.13.0.1

  • Fixed Haddock typos.

Changes in 2999.13.0.0

  • Added support for the osage and patchwork visualisation tools, available as of Graphviz-2.28.0.

  • Updated attributes as of Graphviz-2.28.0:

    • SVG colors are now supported, and the support for different colors has been revamped.

    • overlap=false is now equivalent to overlap=prism and the RemoveOverlaps option has been removed.

    • LabelScheme and Rotation are new attributes for use with sfdp.

    • Scale is a new attribute for use with twopi.

    • Add new italics, bold, underline, superscript and subscript options for HTML-like labels.

    • LHeight and LWidth for getting the height and width of the root graph and clusters.

  • Updated attributes from the current development branch of Graphviz (i.e. 2.29.*). Please note that these will probably not work yet, but are implemented now for future-proofing.

    • A new style for edges: Tapered.

    • XLabel allows you to specify labels external to a node or edge. ForceLabels allow you to specify that these should be drawn even when they will cause overlaps.

    • ImagePath allows you to specify where to search for images.

    • HTML-like labels now support ID values as well as horizontal and vertical rules.

    • BgColor and FillColor now take a list of colors: this allows gradient fills for graphs, clusters and nodes. The Radial style and GradientAngle are also used for this purpose.

    • FillColor is now used by edges to set the color of any arrows.

    • WebP output support added.

  • Other attribute changes:

    • Use a specified data type for the Ordering attribute rather than an arbitrary Text value, and provide a documented wrapper in Data.GraphViz.Attributes.

    • Bb has been renamed BoundingBox.

    • ID now only takes EscString (a type alias for Text) values rather than arbitrary Labels.

    • The Data.GraphViz.Attributes.HTML module has had all values re-named and is now meant to be imported qualified. It is also no longer re-exported from Data.GraphViz.Attributes.Complete.

  • The ToGraphID class provides a common wrapper to help create cluster identifiers, etc.

  • Cabal’s Test-Suite functionality is now used. As part of this, the Data.GraphViz.Testing module and sub-modules are no longer exported by the library.

  • The new Benchmark support in Cabal-1.14 is now used for the benchmark script.

  • Dropped support for b