TreeGraph 2 allows you to reroot your tree at any position. Rooting in this case means defining the node which is located at the leftmost position of the tree and is parent to all other nodes in the document (no matter if the root node is displayed or not).
You can use this function by selecting a branch which defines the position of the new root and clicking on "Root here" in the edit menu or the context menu. Alternatively you can use the keyboard shortcut Ctrl + R.
To avoid confusion we will first have a look at what it means to have a document with an unrooted tree (e.g. from a Nexus file with the
[&U] option). In that case a root node is used internally anyway but is displayed without a branch which would define the rooting point. Whether the root branch is displayed or not influences the topology of the represented tree but (for technical reasons) not the internal representation in the TreeGraph 2 data structure. Because of that the displaying of the root branch is a document format. The following examples illustrate this further.
All examples shown here represent the same tree topology but differ in the internal representation in TreeGraph 2. (The network representation in the left shows the topology more clearly.)
All trees shown below can be created from the corresponding tree representation in the unrooted example above by changing the document formats to display the root branch although they do all represent different tree topologies.
You can use the reroot function no matter if the root branch is displayed or not. To do so select a branch and click "Root here" in the edit menu or the context menu. A new root node will be inserted in the middle of this branch and the two nodes currently connected by it will become the child nodes of the new root (see examples below).
The tree in the following examples is rerooted at the branch B4 (blue). Deleted elements are shown in red and newly inserted elements in green. As you can see after the rerooting B4 is leading to the same node as is did before the operation but is now also connected to the newly inserted root node (which would not displayed as a real node if you chose the unrooted representation). Additionally a second branch was inserted which is leading to the second subtree under the root which was previously connected to the other side of B4. You could consider it in the way that the old B4 was split into the new B4 and the additional branch by the insertion of the new root.
The former root as well as its afferent branch and one of its subbranches (not necessarily the upper one) are deleted in the following examples where we assume that there is no node/branch data attached to any of the nodes and branches in the tree. Which elements are deleted and what happens to their node/branch data is described further below.
If you use the unrooted representation B4 together with the inserted branch and the root node look as if they were one branch that connects the subtree of N7, N8 and N9 with the subtree of N3 and N5 .
The following examples show what happens to the root node, its direct subbranches and their attached node/branch data in all possible cases. The text labels shown in the examples are exemplary for all node/branch data-lines as well as icon labels.
The label Top has moved to another branch. If the tree would be displayed unrooted its position would be topologically identical.
The label Top has moved to another branch. If the tree would be displayed unrooted its position would be topologically identical. B3 contains two labels with the same ID now.