User:Hummel-riegel/GraphViz

This page is under construction Attention: This Extension is currently work in progress - The code may be functional but I don't give any guarantees Please visit the Extensions Extension:Graphviz oder Extension:GraphVizAndMSCGen for the actual code that I want to improve here.

Feel free to add your own stuff or to modifiy this page!

= Extension:GraphViz =

With this extension you can draw graphs with the help of the GraphViz or the MscGen-Tool. Automatic graph drawing has many important applications in software engineering, database and web design, networking, and in visual interfaces for many other domains. You can use the provided language (e.g. dot) and create graphs with that within the wiki. There are also some other extensions that provide other intefaces for individual solutions.

Contributions
In 2004 the User Coffman created an extension to mediawiki in response to a basic need : Render Graphs online. He found the utility Graphviz on another wiki, and thought about adopting it to mediawiki (the wiki he actually used). Exploring the Graphviz tool he discovered an incredible tool to making Graphs. Later on many people improved the extension on their own or provided little bugfixes as snippets on the dicussion page. This led to several functional solutions for different use cases and to a bit of chaos. Now (Fall 2010) I (Thomas Hummel) will try to merge the most common solutions so that we finally have another working solution for several OSes in one file. As I am not that well known to PHP there might be several long-winded or impractical lines in the code - so feel free to send me your improvements or comments (Discussion-Page, Message or whatever). I started with the "improved version" from an unknown Coder and tried to fix some things on my own and then include parts of the code of other "improvements". Good sources were for example Extension:GraphVizAndMSCGen by Matthewpearson.

Alternatives
If you don't like this extension there are some others that I find remarkable (although I tried to put the main functionality of all of them into this extenstion).
 * I don't know how good this acutally works but it seems well coded

GraphViz

 * 1) First of all you need at least one of the external tools "GraphViz" or "MscGen" that renders your Graph.
 * 2) Then Copy the Code found here User:hummel-riegel/GraphViz/GraphViz.php into a file called GraphViz.php and and place it in  .  Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
 * 3) Make sure that write permissions for the "$IP/images" directory are granted.
 * 4) Add these lines to LocalSettings.php:
 * Windows Default: "C:/Programme/ATT/Graphviz/bin/" (without dot.exe)
 * Other Platform : "/usr/local/bin/" (where the dot binary is)

MscGen
The same procedure as with GraphViz - the path to MscGen has to be provided in the LocalSettings.php.

Furthermore you have to uncomment the parser-Hook in the extension-file itself.

-tbd - til its done please use the instructions here: Extension:GraphVizAndMSCGen

Differences to previous versions
The varable $dotCommand that points only to the dot executable is replaced (like in GraphVizAndMSCGen) with $execPath that lets you choose between several renderers.

Configuration Parameters
There are some additional configuration parameters that help you to define a basic behaviour of the extension. If you don't use these parameters they contain a default value that leads to a (hopefully) good usage of the extension. For each parameter add the line  in your LocalSettings.php after the  -line.

Each of these parameters beside the execPath and mscgenPath can be changed for each individual graph created. They are used in the LocalSettings.php only for the default behaviour of all graphs in this wiki.

missing: name, border, position, renderer, ....

Drawing Graphs
Basically you only need to write your Graph in the dot-language (or any other supported language by Graphviz or MscGen) and put it into  or.

Code
User:hummel-riegel/GraphViz.php

Projects based on this extenstion

 * 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.
 * Extension:Semantic Result Formats/graph_format (displays connections between pages (as graph)
 * Extension:Semantic Result Formats/process_format (displays process graphs)