An Introduction to GraphViz

How to use command-line tools and basic GraphViz utilities to produce graphs both simple and complex.

Making an RCS Revision Tree

The following example presents a graphical representation of an RCS revision
tree structure. Again, Perl is the programming language of choice. As
you can imagine, the Perl script is not perfect in the sense that it
does not cover all the possible revision tree structures. In this
example, small revision trees are presented for illustration purposes.
For complex revision trees, greater consideration of the
specialties of the revision tree must be made when writing the Perl script.

The basic idea behind the script is to first get the output we
want from the rlog command. The rlog command returns a lot of
information about the change history of the file, so we have to grep the output to get the
desirable data. The rlog utility is included in the RCS revision
control system.

The key point in the script is to separate the revision branches by the
first part of the revision number. This way, each revision branch has
its own subgraph.

Notice that you have to put the quotation marks around the revision names.
Otherwise, the output is not displayed properly. See Figure 7 for the output
and Listing 7 for the Perl source code.

Our next example is of a graph more commonly needed: a graphical
representation of operating system directory structures.
Keep in mind there is a limitation to the number of
directories that can be presented, due to page dimension restrictions.
This Perl script has been tested with a small number of directories.
Also, the directory structure itself is the most important
factor for the output quality. Meaning, if we can imagine the
directory structure as a tree structure, it can make a great difference if
the maximum levels of the tree are four and if the maximum levels of the
tree are ten, with most of the limbs having a depth of three.

Notice that each box does not display the full path name, only the last
part of the directory name. You can find the full path name by
following the links. Please see the source code to understand how the script works.
Keep in mind that the source code was not tested fully; it is simply
presented to show what the dot language can do with a little help from
a script language. See Figure 8 for the output and Listing 8 for the Perl source code.

Great article!
I wrote a web log analyzer that outputs a graphviz
graph from the web server logs (www.hping.org/visitors)
and I think I can modify the program to produce a better
output thanks to this article.

Btw a note about the graphviz's license: it's not opensource
if I remember correctly (or at least not an OSI approved
license).