Tcldot is the Tcl package for Graphviz: the Graph Visualization Software. It makes the '''[dot]''' graph renderer (for directed graphs) and the neato renderer (for undirected graphs) available to Tcl scripts.
See http://www.graphviz.org/pdf/tcldot.3tcl.pdf for the documentation.
Graphviz is available for Windows, Unix and MacOS X.
----
**Example**
Let's take a simple directory hierarchy:
dir1
|---CVS
|---src
| |---doc
|
|---vfs
| |---bin
| |---config
| | |---ps
| | |---pw
| | |---pure
| |
| |---step1
| |---substep
|
|---www
|---cgi
The Tcl script starts like this:
package require Tk
package require tcldot
# a canvas to put the redered output into:
set canv [canvas .canv]
pack $canv
The first step is to make a description of this hierarchy in the dot language (find a summary here: [http://www.graphviz.org/doc/info/lang.html]). Note, that in this simple case, all directory names are unique. In reality, this would normally not be the case and the description would be more complicated.
set graph [dotstring {
digraph G {
dir1 -> CVS;
dir1 -> src -> doc;
dir1 -> vfs-> bin;
vfs -> config -> ps;
config -> pw -> pure;
vfs -> step1 -> substep;
dir1 -> www -> cgi;
}
}]
Hmm, does not work. Gives a syntax error for the description ... - some changes made, works for me ([EMJ]).
The next step is to simply call the renderer:
eval [ $graph render $canv DOT ]
and size the window to match the bounding box of the graph layout
scan [$graph queryattr bb] "{%d %d %d %d}" ulx uly lrx lry
$canv configure -height [expr $lry + $uly + 5]p -width [expr $lrx + $ulx + 5]p
[[Place the picture ldof th_e grxamph hlere ...]]
----
For another example, see [XML Graph to canvas]
----
[schlenk]
If you need Tcldot for Windows, send me an email, i might find the dll and the VC6 project file.
----
!!!!!!
%|[Category Graph Theory]|[Category Package]|%
!!!!!!