Tip-Over Layout Modes

As in radial layout, drawing in free layout mode can be adjusted to the aspect ratio of the area. Free layout mode can also use tip-over alignment to balance the drawing between height and depth.

While tip-over alignment can be specified explicitly for individual nodes, the Tree Layout Algorithm also has layout modes that automatically use tip-over alignment when needed. These are the tip-over layout modes.

The tip-over layout modes work as follows: Several tries are performed in free layout mode. For each try, some tip-over alignments are set for individual nodes, while the specified alignment of all other nodes is preserved. The algorithm picks the try that best fits the specified aspect ratio of the drawing area.

The aspect ratio can be set by one of the following methods (see Aspect Ratio in the Radial Layout Mode):

void setAspectRatio(const IlvAbstractView* view);

void setAspectRatio(const IlvRect& rect);

void setAspectRatio(IlDouble aspectRatio);

The tip-over modes are slightly more time-consuming than the other layout modes. For very large trees, it is recommended that you set the allowed layout time to a high value (that is, 60 seconds) when using the tip-over modes, by:

layout->IlvGraphLayout::setAllowedTime(60);

This avoids running short of time for sufficient iterations of the layout algorithm. Because it would be too time-consuming to check all possibilities of tip-over alignment use, there are heuristics that check only certain tries, according to four different strategies:

Tip-Over Strategies

Tip Leaves Over

To use this tip-over strategy, set the layout mode in this way:

layout->setLayoutMode(IlvTreeLayoutTipLeavesOverMode);

The heuristic first tries the layout without any additional tip-over options. Then it tries to tip over the leaves, then the leaves and their parents, then additionally the parents of these parents, and so on. As a result, the nodes closer to the root use normal alignment, and the nodes closer to the leaves use tip-over alignment.

Tip Roots Over

To use this tip-over strategy, set:

layout->setLayoutMode(IlvTreeLayoutTipRootsOverMode);

The heuristic first tries the layout without any additional tip-over options. Then it tries to tip over the root node, then the root and its children, then additionally the children of these children, and so on. As a result, the nodes closer to the leaves use normal alignment, and the nodes closer to the root use tip-over alignment.

Tip Roots and Leaves Over

To use this tip-over strategy, set:

layout->setLayoutMode(IlvTreeLayoutTipRootsAndLeavesOverMode);

The heuristic first tries the layout without any additional tip-over options. Then it tries to tip over the root node and the leaves simultaneously; then the root and its children, and the leaves and its parent; then additionally the children of these children and the parents of these parents, and so on. As result, the nodes in the middle of the tree use normal alignment, and the nodes closer to the root or leaves use the tip-over alignment.

This is the slowest strategy because it includes all tries of the strategy “tip leaves over” as well as all tries of the strategy “tip roots over.”

Tip Over Fast

The fast tip-over is a compromise between all other strategies. To use this strategy, set the layout mode in this way:

layout->setLayoutMode(IlvTreeLayoutTipOverMode);

The heuristic tries a small selection of the other strategies, not all possibilities. Therefore, it is the fastest strategy for large graphs.

It is possible that all four strategies yield the same result, because the strategies are not disjoint, that is, certain tries are performed with all four strategies. Furthermore, the tip-over modes do not necessarily produce the optimal layout that gives the best possible fit to the aspect ratio. The reason is that certain unusual configurations of tip-over alignment are never tried, because otherwise the running time would be too high.