René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

graphviz [dot and/or neato]

graphviz is an open source graph visualization software. It basically takes an (textual) input file (for example this dot file) that declaratively describes the graph and convertes it into a viewable output format (such as bmp, gif, ps etc).

Components that come with graphviz

The entire software comes with the following components.

dot

dot (as well as neato) is one of the (imho) main components: it converts the input file into the graphical representation.

neato

dotty

dotty is a customizable graph editor. Its main components are a programmable viewer (lefty) and graph layout generators (dot and neato).

lefty

lefty is a two-view graphics editor for technical pictures.

libgraph

Basic graph data structures, operations, and file I/O for C and C++ programs are encapsulated in libgraph.

tred

tred computes transitive reductions of directed graphs. When applied to dense graphs, this operation removes many edges without modifying the property of reachability between nodes.

unflatten

unflatten adjusts lengths of leaf edges or wide fan-out fan-in patterns. When applied to bushy graphs, this yields layouts having less extreme aspect ratios.

gpr (graph processor)

gpr applies a given predicate expression on node or edge attributes to select a subgraph, that is emitted. A command line option enables path contraction on non-selected nodes and edges.

colorize

colorize allows setting "seed" colors on some nodes, and propagates colors along edges to help highlight nodes that are logically related, even when dispersed geometrically.

dot vs neato

dot draws hierarchical layouts of directed graphs while neato creates spring model layouts.
It looks like dot is better suited for directed graphs while neato is better suited for undirected graphs. Still, neato and dot are compatible insofar that they can use the same input file and command line options.
Here's the dot guide [pdf].
neato implements the Kamada-Kawai algorithm.

Simple dot file

digraph TestGraph {
  node [shape=ellipse fontsize=10 fontname="Courier"        ]; ell_a ell_b ell_c;
  node [shape=box     fontsize=13 fontname="Verdana"        ]; box_a box_b box_c;
  node [shape=diamond fontsize= 9 fontname="Times new Roman"]; dia_a dia_b dia_c;

  "ell_a" [label="Ellipse A"];
  "ell_b" [label="Ellipse B"];
  "ell_c" [label="Ellipse C"];

  "box_a" [label="Box A"];
  "box_b" [label="Box B"];
  "box_c" [label="Box C"];

  "dia_a" [label="Diamond A"];
  "dia_b" [label="Diamond B" color=red];
  "dia_c" [label="Diamond C" color=red];

  "ell_a" -> "box_a"  [label="From Ellipse to Box" fontname="Verdana" fontsize=8];
  "box_a" -> "dia_a";

  "box_a" -> "box_b"  [label="Connecting boxes" fontname="Verdana" fontsize=8];
  "box_b" -> "box_c";

  "dia_b" -> "dia_c"  [color=red fontcolor=green label="Important link" fontsize=9 arrowhead=none];

  "box_a" -> "ell_b"  [fontname="Arial" label="one to many" fontsize=9 arrowhead=crow];
}

Subgraphs

  • Groups related nodes and edges together
  • Provides a context for common attributes (for example default color for nodes)
  • If the name begins with cluster, the nodes and edges within the subgraphs are drawn together (within a bounding rectangle).

SVG

Emitting an SVG graph:
dot -Tsvg my_graph.dot -o my_graph.svg

Getting the coordinates of the nodes

Using the -Tplain or -Tpixel options, it is possible to retrieve the coordinates of the nodes as well as their dimensions.

Output to Post Script

If dot is used to output a graph to Post Script (to be later viewed with for example GhostView), one might use one or both of the following two statements:
orientation =  land;
page        = "8.27,11.69"; // A4
Page defines the page size for the output.

Examples

Parsing SQL create table statements and producing an ERD out of it.

Links

Related

  • EDGI
  • GraphEd
  • daVinci (University of Bremen)
  • XmGraph toolkit
  • GraphBase (Knuth Standford)
There is violet: The very intuitive object layout editing tool.