Extension:GraphViz

The GraphViz extension lets you create and display graphs as in-line images on wiki pages using tools from the open-source Graphviz and Mscgen projects:
 * Graphviz (short for Graph Visualization Software) is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT files.
 * Mscgen (short for MSC generator) is a software tool for drawing message sequence charts from a text source file.

Installation

 * 1) Install one of the external tools "Graphviz" or "Mscgen".
 * 2) Windows: Get your copy here: http://www.graphviz.org/Download.php or here http://www.mcternan.me.uk/mscgen/
 * 3) Unix: Same links as for windows but normally it should be pre-installed (at least graphviz - search for dot) or can be found in the package manager.
 * 4) Ubuntu/Debian:
 * 5) Download the GraphViz extension archive from GIT and extract it into your MediaWiki "/extensions/GraphViz" directory.
 * 6) Update LocalSettings.php to include the following:
 * 7) Visit your wiki's Special:Version page and verify that the correct version of the GraphViz extension is installed.
 * 8) Set the  parameters in LocalSettings.php if the defaults do not suit your environment.
 * 1) Visit your wiki's Special:Version page and verify that the correct version of the GraphViz extension is installed.
 * 2) Set the  parameters in LocalSettings.php if the defaults do not suit your environment.


 * Make sure that write permissions for the "$IP/images" directory are granted.
 * Make sure that internet users get read/execute access on your executables if you use server installations (especially under Windows).

Configuration
For each parameter, add the line  in your LocalSettings.php after the line

Drawing Graphs
You may define a graph in the dot language and enclose it in graphviz tags as follows:

You may define a message sequence chart in the mscgen language and enclose it in mscgen tags as follows:

When the wiki page is saved (or when you click "Show preview" after editing) an image is produced that corresponds to the DOT or mscgen text and it is shown in-line on the page. The image is also uploaded so it may be included in other pages directly.

See the for some basic graphs.

Graph Tag Attributes
Graph tag attributes may be supplied with either graphviz or mscgen as follows:

The following extended image syntax attributes are supported as graph tag attributes: type, border, location, alignment, size, link, alt, caption.


 * svg requires additional configuration.

Multiple Graphs Per Page
For graphviz, use unique names for each graph to display multiple graphs on the same page.

For mscgen, use the "uniquifier" tag attribute to display multiple message sequence charts on the same page.

Links
Graphs in the DOT and mscgen languages may include URLs. These follow the pattern URL="link" where "link" is governed by the ImageMap syntax:

"'All links are given in either the form Page title or description . In the latter case, the part after the pipe becomes the title attribute of the link—in most browsers, it will pop up as a tooltip when the user hovers over it; the part after the pipe also becomes the alt text for the link. If no explicit link description is given, the page title is used.'"

Additionally, external links are supported with or without square brackets. Specify external links without square brackets in order to honor DOT tooltip attributes (e.g. URL=" http://mediawiki.org ", tooltip="MediaWiki"). The MediaWiki "external link with different label" form is also supported (e.g. MediaWiki ).

See for an example with links.

Restrictions
This extension imposes the following restrictions on the DOT language input:
 * Any image attribute values are required to be the names of uploaded files.
 * Any IMG SRC attribute values in HTML-like labels are required to be the names of uploaded files.
 * The imagepath attribute is not allowed.
 * The shapefile attribute is not allowed.
 * The fontpath attribute is not allowed.

Examples
In addition to the examples below, here is a nice flickr gallery of graphviz-rendered graphs.

Contributions and history

 * In 2014, Keith Welter re-wrote the extension (creating version 1.0) to improve security, performance, documentation and ease of use. New features with version 1.0 include:
 * rendered graph images are uploaded to the wiki
 * graphs are only re-rendered when the graph source changes
 * embedded links work properly when the graph image is resized (powered by Extension:ImageMap)
 * embedded links support tooltips (powered by Extension:ImageMap)
 * DOT image attribute support
 * deterministic file clean-up (active files are retained, inactive files are deleted)
 * support for multiple message sequence charts per page
 * security fixes
 * extensive internal documentation (doxygen format)
 * See Extension:GraphViz/v0.9 for history prior to version 1.0.

Dependencies
The GraphViz extension depends on Extension:ImageMap as of version 1.0.

The following extensions depend on the GraphViz extension:
 * The "Semantic Result Formats" extension is used in conjunction with the Semantic MediaWiki extension, that bundles a number of further result formats for SMW's inline queries.
 * graph format (displays connections between pages as graphs)
 * process format (displays process graphs)
 * Extension:Collaboration_Diagram (renders and visualizes a bipartite graph of any article and its editors)