psgraph
psgraph is a small package for generating PostScript pictures of directed acyclic graphs written by Joe Bates and mentioned here: Repositories of Lisp Software. It allows arbitrary information to be displayed by a node, and it supports programmable generation of trees, similar to CLIM's tree drawing.

It is portable Common Lisp, and has been tested sucessfully on SBCL, Clisp, Allegro, CMUCL, and LispWorks.

Example

This code (look at psgraph.doc file) will make a pretty, small graph:

;; Load psgraph
(asdf:oos 'asdf:load-op :psgraph)

;; Set some drawing settings
(setf psgraph:*boxkind* "fill")
(setf psgraph:*boxgray* ".8")
(setf psgraph:*fontsize* 8)
(setf psgraph:*second-fontsize* 6)

;; This function will be given the name of a node, like 'A, and
;; return a list of the node's children.
(defun children (x)
  (cond ((eq x 'A) '(B C D))
	((member x '(B C D)) '(E F G))
	((member x '(E F G)) '(H))
	(t nil)))

;; This returns the information to be displayed for a node.
(defun info (x)
  (list (string x)))

;; This is the top-level function
(defun graph (&optional (shrink t))
  (with-open-file (output-stream "g.ps"
				 :direction :output
				 :if-exists :supersede)
    (psgraph:psgraph output-stream 'A #'children #'info shrink nil #'eq)))

Just call (graph) and view g.ps. You will see something like this:

An example graph

Download

It can be downloaded from the asdf-packaging home page.


plotting graphics library