17.4 Selecting subtrees and cut/copy/pasting subtrees
In decision trees, a subtree refers to a part of a tree. A node's subtree is comprised of all nodes and branches to its right (its “descendants”), but not including the original node (the subtree's root). In addition to being able to duplicate and move subtrees in the Tree Diagram Editor, it is also possible to manipulate subtrees using the mouse and CONTROL key in the Tree Explorer View.
We will cover how to select subtrees and nodes in a number of ways. A few tree-building operations — copying, pasting, cutting, clearing, and cloning — require a special method for selecting a subtree.
Selecting a subtree
-
While holding down the CONTROL key, click on the subtree’s root node.
-
... OR ...
-
Right-click on the subtree’s root node and choose "Select Subtree" from the context menu.
TreeAge Pro offers several methods for selecting multiple, unrelated nodes. These techniques can be used when changing node types, entering payoffs, and a few other tasks.
To select a set of unrelated nodes:
-
Select any node.
-
While holding down the SHIFT key, select another node by clicking on it. Continue adding to the selection using the same shift-clicking operation.
To remove nodes from the selection:
-
Hold down the SHIFT key and click, one after the other, on each of the selected nodes that you wish to deselect.
-
It is possible to select multiple nodes by dragging a selection rectangle around them.
To select several adjacent nodes:
-
Click and drag to create a selection rectangle that encloses the adjacent nodes you wish to select.
-
Release the mouse button.
Selecting multiple nodes by characteristic:
-
Choose Tree > Select Nodes If from the menu.
-
Choose a selection method in the left pane of the Select Nodes If Dialog (Node Type; Node Name/ID; Position in Tree; Variable Defined).
-
Select the options associated with that method in the right pane of the Select Nodes If Dialog.
-
Click OK.
The Select Nodes If dialogue is shown below.
Now you can select subtrees, we can cut/copy and paste them.
To copy a subtree:
-
Select a subtree as specified above.
-
Choose Edit > Copy from the menu.
-
... OR ...
-
Click CONTROL + C on the keyboard.
Once copied to the clipboard, the subtree can be pasted to any non-terminal node — one with or without branches, in the same tree or a different one.
To paste a subtree:
-
Right-click on any single non-terminal node and choose Paste from the context menu.
-
... OR ...
-
Select any single non-terminal node and click CONTROL + V on the keyboard.
If you want to carry all information (e.g., Markov, DES) from the source subtree to the pasted subtree, be sure the source and destination subtree root nodes have the same node type.
To move a subtree, rather than duplicate it, use the Cut Subtree commands.
To cut a subtree:
-
Select a subtree as specified above.
-
Choose Edit > Cut from the menu.
-
... OR ...
-
Click CONTROL + X on the keyboard.
This will cause the subtree (but not the subtree’s root) to be removed from the tree and placed on the clipboard. As with a copied subtree, when a subtree is cut to the clipboard, the Paste Subtree command becomes available.
When a subtree is cut/copied/pasted, the structure of the subtree is maintained to preserve the parent/child relationships among the nodes. When an assortment of nodes are selected, there may or may not be parent/child relationships among the nodes. Therefore, special care must be taken to ensure that the cut/copy/paste functions change the model as desired.