springgraph input (.dot) files

Definition of the .dot files which springgraph renders can be found in the graphviz man pages. Springgraph only supports the fillcolor and label node attributes, and only when set for a specific node, not set as a default. Example .dot files can be found here.

I am going to attempt to describe this file format as it is supported by springgraph. I am going to include things that springgraph ignores because graphviz requires it, and I want to maintain compatibility, and because springgraph may some day require them.

There are four types of lines:

Header:
A single line, ignored by springgraph.
Node Attribute:
Optional, they can define the fillcolor and/or label
Link:
Specify which nodes an arrow should be drawn between
Footer:
A single line, ignored by springgraph.

Header
The first line should be 'digraph "" {'. graphviz uses the information between the double-quotes as the title of the graph. This is currently ignored by springgraph but is required for compatibility with graphviz.

Node Attribute
You can add node attribute lines to define the label (text that will be in the node) and fillcolor (background color) of the node. The fillcolor must be specified in HSV (Hue, Saturation, Value), not RGB (Red, Green, Blue). This line is completely optional. If you omit it, the node name will be used as the node label. An example node attribute line:

"0E9FF879" [fillcolor="0.866515837104072,0.257575757575758,1",label="Darxus"]

In this example, the node name is "0E9FF879". The fillcolor has Hue = 0.866515837104072, Saturation = 0.257575757575758, and Value = 0.257575757575758. The label is "Darxus".

Some example colors:

"red" [fillcolor="0.00,1,1"]
"yellow" [fillcolor="0.17,1,1"]
"green" [fillcolor="0.33,1,1"]
"cyan" [fillcolor="0.50,1,1"]
"blue" [fillcolor="0.67,1,1"]
"magenta" [fillcolor="0.83,1,1"]

Link
Link (edge) lines specify which nodes arrows should be drawn between. They look like this:

"0E9FF879" -> "116F0CBD"

This quite simply means "Draw an arrow from the node named '0E9FF879' to the node named '116F0CBD'". If you use "--" instead of "->", an arrowhead will not be drawn on the line.

Footer
The last line should be "}". This is currently ignored by springgraph but is required for compatibility with graphviz.


A very simple example: The file test.dot contains (only) the following:
digraph "" {
one -> two
two -> three
three -> four
four -> five
five -> one
one -> three
}
It is rendered like this:

$ cat test.dot | ./springgraph.pl > test.png

And test.png looks like this:

test.png


springgraph index
Darxus' code index
Darxus' home page
Thu May 16 06:06:39 EDT 2002