Tk Canvas Graph Layout

Location:

Acknowledgement

Version 1.1 of this software, by Dennis Heimbigner (dennis@cs.colorado.edu), is a mild re-write and a re-packaging of a portion of the tkMegaWidget and tkIcon system of of Sven Delmas (garfield@cs.tu-berlin.de) of the Tech. Univ. Berlin. Sven's TkIcon system provided a very nice and useful mechanism for defining graphs (node icons + edge canvas items) and doing layout over them.

This re-package was constructed because the original tkIcon+tkMegaWidget system, made me uncomfortable with the amount of modification to the Tk sources that it required. It was a bit too heavyweight. This re-packaging sacrifices some features for simpler insertion into Tk (see installation below).

Version 1.2 of this software, by Will Taylor (taylor@ptolemy.arc.nasa.gov), is a conversion from Tk 3.6 to Tk 4.0. into Tk (see installation below).

Version 1.3 of this software, by Will Taylor (taylor@ptolemy.arc.nasa.gov), is a conversion from Tk 4.0 to Tk 4.1.

Description<\h2> The Tk canvas window type has been augmented to allow graph layout of the selected canvas items. It operates by associating extra graph information with the canvas. Items are created using the normal canvas operations. Any existing item may, by a separate command to the canvas, be added to or removed from the list of items layed-out by the graph. Four styles of layout are currently supported: ISI, Tree, Random, and Matrix. Some simple experiments will demonstrate the differences. A new type of item, Edge (taken from tkIcon) is provided as the means of laying edges between nodes. Non-edge canvas items are treated as nodes, but not all canvas item types can be handled by the graph layout code. A more complete description is provided by the "man page" file: graph.n.

Installation:

The following source files are in the tar file of the distribution: tkCanvas.c, tkCanvas.h, tkCanvEdge.c, tkCanvLayout.c, tkCanvLayout.h. There are also some additional files such as graph.n, Makefile.in, tklayout.tcl, HISTORY, and README.html (this file).

In order to install, perform the following steps.

  1. Un-tar the tklayout.tar file, this will produce a directory named tklayout.
  2. Copy the files tkCanvas.c, tkCanvas.h, tkCanvEdge.c, tkCanvLayout.c, and tkCanvLayout.h into your tk4.1 directory. WARNING, this will overwrite the existing tkCanvas.c and tkCanvas.h, so you may want to save them. Note that I have tried to wrap all changes within an ifdef of CANVASLAYOUT.
  3. Modify your Makefile to build tkCanvas.o and tkCanvLayout.o. You can look at the tklayout/Makefile.in to see how this might be done (or use that Makefile.in directly).
  4. Re-build and re-install Tk4.1
  5. Start up the wish program and source tklayout/tklayout.tcl. Execute the demo command (tklayoutdemo) to see if things appear to be working. <\ol>

    Contact and Bug Reports:

    This is a rather quick and dirty re-packaging, and has not been thoroughly tested, so I am sure that many bugs exist. I would appreciate hearing about them, and better yet, receiving patches.
    Will Taylor (taylor@ptolemy.arc.nasa.gov)