The DejaVU Framework -- hush 3.1
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?

Manual: TCLDOT 1 "02 December 1996"


[.] [man] man1 man2 man3 man4 man5 man6 man7 man8 man9 manl mann ?

NAME

tcldot - directed graph manipulation in tcl

SYNOPSIS


#!/usr/local/bin/tclsh package require Tcldot


slide: SYNOPSIS

USAGE


Requires the dynamic loading facilities of tcl7.6 or later.


slide: USAGE

INTRODUCTION


tcldot is a tcl7.6 dynamically loaded extension that incorporates the directed graph facilities of dot(1) into tcl and provides a set of commands to control those facilities. tcldot converts dot from a batch processing tool to an interpreted and, if needed, interactive set of graph manipulation facilities.


slide: INTRODUCTION

COMMANDS


tcldot initially adds only two commands to tcl, namely dotnew and dotread. These commands return a handle for the graph that has just been created and that handle can then be used as a command for further actions on the graph. All other "commands" are of the form:

Many of the methods return further handles of graphs, nodes of edges, which are themselves registered as commands. The methods are described in detail below, but in summary:

Graph methods are:

Node methods are:

Edge methods are:

  
          set g [dotnew digraph rankdir LR]
  
  
          
          set f [open test.dot r]
          set g [dotread \$f]
  
  
          
          set n [\$g addnode "N" label "Top\\nNode" shape triangle eggs easyover]
  
  
A possible cause of confusion in tcldot is the distinction between handles, names, labels, and variables. The distinction is primarily in who owns them. Handles are owned by tcldot and are guaranteed to be unique within one interpreter session. Typically handles are assigned to variables, like "n" above, for manipulation within a tcl script. Variables are owned by the programmer. Names are owned by the application that is using the graph, typically names are important when reading in a graph from an external program or file. Labels are the text that is displayed with the node (or edge) when the graph is displayed, labels are meaningful to the reader of the graph. Only the handles and variables are essential to tcldot's ability to manipulate abstract graphs. If a name is not specified then it defaults to the string representation of the handle, if a label is not specified then it defaults to the name.
  
          set n [\$g addnode]
          set m [\$g addnode]
          \$g addedge \$n \$m label "NM"
  
          \$g addnode N
          \$g addnode M
          \$g addedge N M label "NM"
  
  
The argument is recognized as a handle if possible and so it is best to avoid names like "node6" for nodes. If there is potential for conflict then use findnode to translate explicitly from names to handles. e.g.
  
          \$g addnode "node6"
          \$g addnode "node99"
          \$g addedge [\$g findnode "node6"] [\$g findnode "node99"]
  
  
There can be an arbitrary number of attribute name/value pairs for the edge. Certain special edge attributes and permitted values are described in dot(1), but the programmer can arbitrarily invent and assign values to additional attributes beyond these.
          
          set sg [\$g addsubgraph dinglefactor 6]
  
  
Clusters, as described in dot(1), are created by giving the subgraph a name that begins with the string: "cluster". e.g.
          
          set cg [\$g addsubgraph cluster_A dinglefactor 6]
  
  
  
          [\$g addnode] addedge [\$g addnode] label "NM"
  
  
  
          #!/usr/local/bin/wish
          package require Tcldot
          set c [canvas .c]
          pack \$c
          set g [dotnew digraph rankdir LR]
          \$g setnodeattribute style filled color white
          [\$g addnode Hello] addedge [\$g addnode World!]
          \$g layout
          eval [\$g render]
  
  
render generates a series of canvas commands for each graph element, for example a node typically consist of two items on the canvas, one for the shape and the other for the label. The canvas items are automatically tagged (See canvas(n) ) by the commands generated by render. The tags take one of two forms: text items are tagged with 0 and shapes and lines are rendered with 1. The tagging can be used to recognize when a user wants to interact with a graph element using the mouse. See the script in examples/disp of the tcldot distribution for a demonstration of this facility.
slide: COMMANDS

BUGS


Still batch-oriented. It would be nice if the layout was maintained incrementally.

No choice of layout engine. The neato undirected-graph engine would be a useful addition.

(The intent is to address these limitations in graphviz_2_0.)


slide: BUGS

AUTHOR

John Ellson, Lucent Technologies, Holmdel, NJ. (ellson@lucent.com)

ACKNOWLEDGEMENTS


John Ousterhout, of course, for tcl and tk. Steven North and Eleftherios Koutsofios for dot. Karl Lehenbauer and Mark Diekhans of NeoSoft for the handles.c code which was derived from tclXhandles.c. Tom Boutell of the Quest Center at Cold Spring Harbor Labs for the gif drawing routines. Spencer Thomas of the University of Michigan for gdTcl.c. Dayatra Shands for coding much of the initial implementation of tcldot.


slide: ACKNOWLEDGEMENTS

KEYWORDS

graph, tcl, tk, dot
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?
Hush Online Technology
hush@cs.vu.nl
09/24/99