17.2.1 Conceptual Overview of Formatting Graphs

When you need to format a graph, you specify the nodes to be in the graph and the scheme for organizing them. The CLIM graph formatter does the layout automatically, obeying any constraints that you supply.

You can format any graph in CLIM. The CLIM graph formatter is most successful with directed acyclic graphs ( DAG ). "Directed" means that the arcs on the graph have a direction. "Acyclic" means that there are no loops in the graph.

Here is an example of such a graph:


Figure 31. A Directed Acyclic Graph

To specify the elements and the organization of the graph, you provide CLIM with the following information:

The root node

A "node printer," that is, a function used to display each node. The function is passed the object associated with a node and the stream on which to do output.

An "inferior producer," a function that takes one node and returns its inferior nodes (the nodes to which it points)

Based on that information, CLIM lays out the graph for you. You can specify a number of options that control the appearance of the graph. For example, you can specify whether you want the graph to grow vertically (downward) or horizontally (to the right). Note that CLIM's algorithm does the best layout it can, but complicated graphs can be difficult to lay out in a readable way.

See 17.5, Advanced Topics for the graph formatting protocol.

CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005