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:
- preorder breadth-first search of S-expression is...
- added to lattice points up to a maximum depth...
- 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.
NOTES:
- the programs here can only handle binary trees for now,
- only the structure of the tree is drawn (node labels are not shown),
- your trees must be represented as Lisp S-expressions,
- or you can hack the scripts on this page for your own purposes.
EXAMPLE:
./doTree sexpr
produces tree.eps (or tree.jpg)
FUTURE WORK:
- if you find a bug, let me know,
- if you improve the code, let me know and I'll post it here,
- 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,
|