The layout algorithm used in the current implementation of WebMap
to calculate the node positions for a spanning tree is based on
the following principles:
Assume a new node is to be inserted into an existing tree as child
.
The precondition is characterized by:
After determining the position of the new node all nodes
of the tree ``above'' and ``to the right'' of are moved to
a new position using a simple recursion:
The y-coordinate of incremented by one.
If the x-coordinate will be the same
as .
's rightmost descendant
incremented by 2.
This is illustrated in Fig. 5. The nodes which moved to the
right after the insertion of a new node with the x-coordinate 8 are
surrounded by a dotted line.
The algorithm causes each node to be located one level above its children and in the middle between its leftmost and its rightmost descendant, which means that its x-coordinate always satisfies the following equation: Here 's leftmost descendant and 's subtree. Note, that all node's coordinates are represented by integer values.