How to compact a subtree

Sometimes it is interesting to hide the contents of a tree and only display its last nodes, those that are childless. This operation we call compaction. While designing your tree you may compact some parts of it. To do so, choose a node, right-click on it, select "more" and then "compact subtree". A triangle under the node represents that it is compacted, and only its childless descendent nodes will be displayed, in a left-to-right order. You may also notice that this node will be colored differently from other nodes.

To "uncompact" a node, that is, to expand it to its normal representation, just right-click on it and then select "more", "expand subtree".

It may be the case that you want to represent a compacted tree whose hidden structure has not been drawn. To do this easily, you may just add a single child and edit its label as to contain the description of the supposed hidden structure. Then simply compact the parent node. There is an automatic operation to do just this, which is to right-click on the node and then select "more", "add a compacted child". The example bellow illustrates this: in the left tree, a compacted child was assigned to the node in order to represent a structure which has {a1, a2, a3, a4, a5} as last nodes. The right tree is the same one but with the node expanded. You can clearly see that there is no hidden structure, but a single child.

It must be explained that while a subtree is hidden under compaction it cannot be edited. To edit the subtree nodes' labels, you must first expand it, then edit them, then compact it again.


Copyright(C) 2008 by Daniel Donadon