Extension:GraphViz

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
GraphViz

Release status: unknown

Implementation Tag
Description Render Graphs online
Author(s) Coffman
Download no link
Example http://www.graphviz.org/Gallery.php

http://www.islandseeds.org/wiki/Test:Graphviz

I (Coffman) have recently (2-oct-2004) created a extension to mediawiki in response to a basic need : Render Graphs online

I found the utility Graphviz on another wiki, and thought about adopting it to mediawiki (the wiki I actually use). Exploring the Graphviz tool I discovered an incredible tool to making Graphs. 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 view a lot of samples at the original page.

Of course the only requisite for this plugin to work is the graphviz program; you can download it from here

You can find information on how to write a graph on the original page at here

Contents

[edit] Requisites

Graphviz 1.12, download from here

[edit] Install instructions

  1. Download Graphviz.php.
An Update can be found here.
  1. Copy Graphviz.php to the $mediawiki/extensions directory.
  2. Add these two lines to LocalSettings.php: (the path may vary depending on your distribution)
include("extensions/Graphviz.php");
$wgGraphVizSettings->dotCommand = "/usr/bin/dot";

If you are installing on a Wiki that is hosted by Windows, follow these additional instructions

[edit] Online samples

[edit] Other rendering engines

I wanted to use other layout engines besides dot(1), so I hacked Graphviz.php to allow a Unix-style interpreter specification for the other rendering engines in Graphviz. This is backwards compatible (since it is a legal dot comment) and avoids coming up with new syntax.

The interpreter spec must immediately follow the opening tag: "<graphviz>#!/sw/bin/neato" for example. I explicitly check for allowed rendering engines to avoid script injection security issues.

Extension at: http://www.Bytesmiths.com/InfoArk/Graphviz.php.gz

Annotated examples at: http://www.IslandSeeds.org/wiki/Test:Graphviz (not working)

Enjoy! --Bytesmiths 14:53, 15 Mar 2005 (UTC)

[edit] Alternates extensions

There is another Graphviz extension located at http://opensource.case.edu/svn/MediaWikiHacks/extensions/Graphviz/trunk/Graphviz.php. This version features automatic pruning of Graphviz files on the filesystem among other small improvements.

An update of this alternate version is avaible here: http://www2.hds.utc.fr/~rherault/index.php/Graphviz_Extension (NO ACCESS). Support for png and svg, support for border and image position

<graphviz border='frame' format='svg'>
digraph G {Hello->World!}
</graphviz>

<graphviz renderer='neato' caption='Hello Neato'>
graph G {
   run -- intr;
   intr -- runbl;
   runbl -- run;
   run -- kernel;
   kernel -- zombie;
   kernel -- sleep;
   kernel -- runmem;
   sleep -- swap;
   swap -- runswap;
   runswap -- new;
   runswap -- runmem;
   new -- runmem;
   sleep -- runmem;
}
</graphviz>

<graphviz caption='Hello SVG and PNG' alt='phylogenetic tree' format='svg+png'>
digraph G {
                node [shape=plaintext];
                Mollusca [URL="Mollusca"];
                Neomeniomorpha [URL="Neomeniomorpha"];
                X1 [shape=point,label=""];
                Caudofoveata [URL="Caudofoveata"];
                Testaria [URL="Testaria"];
                Polyplacophora [URL="Polyplacophora"];
                Conchifera [URL="Conchifera"];
                Tryblidiida [URL="Tryblidiida"];
                Ganglioneura [URL="Ganglioneura"];
                Bivalvia [URL="Bivalvia"];
                X2 [shape=point,label=""];
                X3 [shape=point,label=""];
                Scaphopoda [URL="Scaphopoda"];
                Cephalopoda [URL="Cephalopoda"];
                Gastropoda [URL="Gastropoda"];
                Mollusca->X1->Testaria->Conchifera->Ganglioneura->X2->Gastropoda
                Mollusca->Neomeniomorpha
                X1->Caudofoveata
                Testaria->Polyplacophora
                Conchifera->Tryblidiida
                Ganglioneura ->Bivalvia
                X2->X3->Cephalopoda
                X3->Scaphopoda
}
</graphviz>

Personal tools