This function does not change the tree structure, nor does it affect tip/node indices and names. It merely changes the order in which edges are listed in the matrix tree$edge
, so that edges are listed in preorder or postorder traversal. Preorder traversal guarantees that each edge is listed before any of its descending edges. Likewise, postorder guarantees that each edge is listed after any of its descending edges.
With options root_to_tips=TRUE
and depth_first_search=TRUE
, this function is analogous to the function reorder
in the ape
package with option order="cladewise"
.
The tree can include multifurcations (nodes with more than 2 children) as well as monofurcations (nodes with 1 child).
This function has asymptotic time complexity O(Nedges).