Extension:Graph/Legacy

Overview
The graph-extension takes a textual graph description between tags, and turns it into a pretty flowchart diagram.

It works much like the GraphViz extension, except that it outputs ASCII, HTML, SVG or Graphviz code. The latter then allows rendering of PNG files.

The advantage of textual, SVG or HTML output over an image is that it makes it possible to easily include mouse-over titles and links in the graph, as well as make the graph scalable and zoomable. In addtion, copy & paste is possible, and search engines will index the text in the graph like the node names and edge labels.

Please see also the overview in the manual.

Input
The input can either be in the own format of Graph::Easy, or in the DOT language used by Graphviz. You do not need the dot tools for parsing either format:

Graph::Easy:

[ Bonn ] --> { style: bold; } [ Berlin ]

or if you want to output by SVG,

graph { output: svg; } [ Japan ] -- capital --> { color: red; } [ Tokyo ]

DOT:

digraph G { "Bonn" --> "Berlin" [ style: bold; ] }

Output
The output can be in ASCII art drawings, Unicode boxcode drawings, HTML or SVG. If you have graphviz installed, you can also render PNG files via dot, neato etc.

Internationalization
If you want to use non ascii characters, add setlocale to LocalSettings.php.

For example, if you want to use Japanese, add setlocale( LC_ALL, "ja_JP.UTF-8" ); to LocalSettings.php.

Examples
Here is an example, as HTML rendered by Firefox (shown as screenshot due to Meta not allowing )

node { fill: #ffdead; }

[ Berlin ] { fill: #f06060; color: white; } -> [ Rostock ], [ Dresden ], [ Magdeburg ], [ Frankfurt (Oder) ] [ Magdeburg ] .. train ..> [ Aschaffenburg ] { fill: #e0e0ff; border: bold; }



Since it is not yet possible to upload SVG files to Meta, please see this SVG example.

Details & Feedback
The extension uses a Perl module called Graph::Easy to parse the input and render the output.

Much more details, documentation, the actual code, examples and testcases can be found at my site.

This is work in progress - but feedback is very much welcome.