aiSee User Manual: Tree Layout

The following example shows a typed syntax tree. This tree can either be drawn by the specialized algorithm for “downward laid-out trees” or by the normal algorithms. When the normal algo­rithms are used to draw a tree, it is advisable to increase the layout down factor in order to obtain good results (see Figure 1). If the layout down factor is not used, the incoming edges draw the nodes too much in the direction of the parent node.

A nice layout is achieved by the specialized tree algorithm with a tree factor of 0.9 (see Figure 2).

If an orthogonal layout is needed, the attribute smanhattan_edges can be used (see Figure 3). For trees, this attribute is more appropriate than the standard Manhattan layout with manhattan_edges.

graph: {title: "Typed Syntax Tree"
        //…
node: { title:"Identifier\ntst3 (0)" }
node: { title:"Identifier\nx (0)" }
node: { title:"INTEGER" }
node: { title:"VarDecl" }
        // …
node: { title:"no type" }
node: { title:"int" }
        // …
nearedge: { source:"Identifier\ntst3 (0)"
            target:"int" }
        // …
       }

See also: 6 layouts of a tree.

Figure 1: Normal Layout Algorithm
Figure 2: Tree Layout

Figure 3: Tree Layout, SManhattan Edges