Steven Gustafson's Tree Visualisation Code

CODE: (updated 15.07.2004)

The bash script doTree converts a Lisp S-expression into points with (awk) scripts, plottable using Gnuplot (script), in the following steps:

  1. preorder breadth-first search of S-expression is...
  2. added to lattice points up to a maximum depth...
  3. preorder depth-first search of points creates plottable lines
All files can be downloaded in visfiles.tar. They require Bash, Awk, and Gnuplot.
After Daida's use of the circular lattice (2002) to visualise genetic programming syntax trees, I began to use the same method. This visualisation is compact; useful for analysis and presentation. It also inspired some population diversity measures (postscript file). See Daida's 2004 GPEM Journal paper for a complete description. Another visualisation of S-expressions is available via Bill Langdon's lisp2dot.awk conversion to Dot files.


  1. the programs here can only handle binary trees for now,
  2. only the structure of the tree is drawn (node labels are not shown),
  3. your trees must be represented as Lisp S-expressions,
  4. or you can hack the scripts on this page for your own purposes.


./doTree sexpr
produces tree.eps (or tree.jpg)


  1. if you find a bug, let me know,
  2. if you improve the code, let me know and I'll post it here,
  3. ways to extend the code:
    • draw node labels,
    • arbitrary arity (probably need to determine max arity, then align nodes with less-than-max arity to the left),
    • codes for other graphing programs,