Graphviz: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 29: Line 29:
* [http://www.graphviz.org/doc/info/attrs.html Node, Edge and Graph Attributes]
* [http://www.graphviz.org/doc/info/attrs.html Node, Edge and Graph Attributes]


=== Some Neato examples ===
We we understood right (this is a disclaimer!)
* You may these (most?) as global settings in the command line
* As global settings in a file
* As "parameter" for each node
 
; size
: defines the size of the output in inches
: Consult Wikipedia's [http://en.wikipedia.org/wiki/Paper_size papersize] or [http://en.wikipedia.org/wiki/ISO_216 ISO 216] articles for pratical tables that translate ISO (European) A,B,C formats to inches.
 
Example of a portrait A2 page:
size="34.4,16.5";
 
=== Some dot command line examples ==
 
Renders a (default) digraph in SVG with the default formatter
dot -Tsvg GCF2.dot > GCF2.svg
 
=== Some Neato command line examples ===


Lists configuration
Lists configuration
Line 44: Line 61:
  neato -Tsvg -Goverlap=scale -Gfontsize=8.0 GCF.dot > GCF.sv
  neato -Tsvg -Goverlap=scale -Gfontsize=8.0 GCF.dot > GCF.sv


 
== Simple graphviz for mediawiki examples ==
== Graphviz for mediawiki examples ==
 
* [http://www.graphviz.org/pub/scm/graphviz2/pdf/dotguide.pdf dot guide]
* [http://www.wikischool.de/wiki/WikiSchool:Graphviz WikiSchool:Graphviz] (Tutorial in German)


In this wiki, a directed graph that is represented like this (if you use the graphviz software, you should remove the XML tags).
In this wiki, a directed graph that is represented like this (if you use the graphviz software, you should remove the XML tags).
Line 161: Line 174:
; Manual
; Manual
* [http://www.graphviz.org/Documentation.php Graphviz - Graph Visualization Software] Includes both introductions and manuals (the HTML versions on top are better currently - [[User:Daniel K. Schneider|Daniel K. Schneider]] 14:40, 20 July 2009 (UTC)).
* [http://www.graphviz.org/Documentation.php Graphviz - Graph Visualization Software] Includes both introductions and manuals (the HTML versions on top are better currently - [[User:Daniel K. Schneider|Daniel K. Schneider]] 14:40, 20 July 2009 (UTC)).
* [http://www.graphviz.org/pub/scm/graphviz2/pdf/dotguide.pdf dot guide]


; Introductions
; Introductions
* [http://en.wikipedia.org/wiki/Graphviz Graphviz] (Wikipedia)
* [http://en.wikipedia.org/wiki/Graphviz Graphviz] (Wikipedia)
* [http://www.wikischool.de/wiki/WikiSchool:Graphviz WikiSchool:Graphviz] (Tutorial in German)
* [http://www.linuxjournal.com/article/7275 An Introduction to GraphWiz], September 10th, 2004 by Mihalis Tsoukalos, Linux Journal
* [http://www.linuxjournal.com/article/7275 An Introduction to GraphWiz], September 10th, 2004 by Mihalis Tsoukalos, Linux Journal



Revision as of 10:28, 22 May 2010

Draft

Definition

  • Graphviz is an open source graph visualization software. It has several main graph layout programs

The GraphViz language

Command line syntax

See Command-line Invocation (at graphviz.org).

Important flags:

-Gname[=value]
Defines attributes of the graph like overlaps, fonts, etc.
-Tformat
-Tformat:renderer
-Tformat:renderer:formatter
Defines the output format. You also can choose from a renderer and change the default formatter for the renderer.
-ooutputfile
specify the output file. Otherwise it's written to default output.

Graphviz attributes

See either (or both):

We we understood right (this is a disclaimer!)

  • You may these (most?) as global settings in the command line
  • As global settings in a file
  • As "parameter" for each node
size
defines the size of the output in inches
Consult Wikipedia's papersize or ISO 216 articles for pratical tables that translate ISO (European) A,B,C formats to inches.

Example of a portrait A2 page:

size="34.4,16.5";

= Some dot command line examples

Renders a (default) digraph in SVG with the default formatter

dot -Tsvg GCF2.dot > GCF2.svg

Some Neato command line examples

Lists configuration

neato -v

List all formats your installation can produce

neato -Tformat:

PNG output without overlap

neato -Tpng -Goverlap=false GCF.dot > GCF.png

SVG output

neato -Tsvg GCF.dot > GCF.svg
neato -Tsvg -Goverlap=scale -Gfontsize=8.0 GCF.dot > GCF.sv

Simple graphviz for mediawiki examples

In this wiki, a directed graph that is represented like this (if you use the graphviz software, you should remove the XML tags).

<graphviz>
digraph G4 {
            "Learning theories" [URL="Learning theory"];
            "Pedagogic strategy" [URL="Pedagogic strategy"];
	    "Instructional design model" [URL="Instructional design model"];
            "Learning theories" -> "Pedagogic strategy";
            "Instructional design model" -> "Pedagogic strategy"
}
</graphviz>

could render like that (yes this wiki has a graphviz extension, but we may not keep it for sure since it is somewhat CPU intensive)

A simple non-directed graph (rendered with neato):

<graphviz renderer='neato' caption='Hello Neato'>
 graph G1 {
    aaa -- bbb;
    bbb -- c;
    aaa -- c;
}
</graphviz>

gives:

Or a more complex non-directed graph (rendered with neato):

<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>

like this

Tools

See Graphviz - Graph Visualization Software (a longer list of interfaces, bindings, generators, scripts, etc.). Usually also needs graphviz software and the other way round. I.e. after installing Graphviz, you likely want to install a viewer or generator.

Mediawiki extensions

GraphiViz Viewers

Installation

  • Download of GraphViz software (source and Win/Linux binaries).
  • Under Ubuntu I could install it through the package manager (there are quite a lot of dependencies).
sudo apt-get install graphviz
  • For solaris, you can download a binary from sunfreeware.com plus these: cairo-1.4.10, freetype-2.3.1, glib-2.14.1, graphviz-2.16.1, pango-1.18.2, xrender-0.8.3,expat-2.0.1.

Tutorials and introductions

Manual
Introductions
Graphviz for UML