Graphviz

From DreamHost
Jump to: navigation, search

GraphViz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. Automatic graph drawing has many important applications in software engineering, database and web design, networking, and in visual interfaces for many other domains. GraphViz will take a script file as input and generate an image from the information given.


Installing GraphViz on Dreamhost servers

Replace yourdomain.com with your own domain name throughout the instructions below.

  • 1. Establish a secure shell (SSH) connection to your server using software such as PuTTY.
  • 2. From inside your home folder, create a temporary folder (in our example I've called it gvtemp):
$ cd $HOME
$ mkdir gvtemp
$ cd gvtemp
  • 3. Download and extract GraphViz:

If you get errors about 'lperl not found' and 'lruby not found', make sure you have the disable switches. The extension for MediaWiki doesn't seem to need them.

$ wget http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.26.3.tar.gz
$ tar xvzf graphviz-2.26.3.tar.gz
$ cd graphviz-2.26.3
$ ./configure --prefix=$HOME/local --disable-perl --disable-ruby
$ make
$ make install
$ make clean
  • 4. Remove the temporary files no longer needed:
$ cd $HOME
$ rm -r gvtemp
  • 5. To test your GraphViz installation and check its working ok, create a file with the following contents, save it as test.txt into your $HOME/yourdomain.com folder.
digraph prof {
  size="16,14"; ratio = fill;
  node [style=filled];
  start -> main [color="0.002 0.999 0.999"];
  start -> on_exit [color="0.649 0.701 0.701"];
  main -> sort [color="0.348 0.839 0.839"];
  main -> merge [color="0.515 0.762 0.762"];
  sort [color="0.408 0.498 1.000"];
  merge [color="0.603 0.258 1.000"];
  main [color="0.650 0.200 1.000"];
  on_exit [color="0.650 0.200 1.000"];
}

Next, from your shell prompt run the following commands to process your GraphViz script:

$ cd $HOME/yourdomain.com
$ $HOME/local/bin/dot -Tpng -o test.png test.txt

Then in your webbrowser, navigate to http://yourdomain.com/test.png and hopefully you should see an image with 5 nodes.


Installing the GraphViz MediaWiki Extension

Once GraphViz is installed you can add the GraphViz MediaWiki extension to your MediaWiki install by following the instructions on MediaWiki's Extension:GraphViz page (you could also check out the talk page for more details and tips). After installation you'll need to edit LocalSettings.php, and add the following:

include("extensions/Graphviz.php");
$wgGraphVizSettings->dotCommand = "$HOME/local/bin/dot";