
Wrappers for the C functions called by
ape::reorder.phylo
.
These call the C functions directly, so are faster -- but don't perform
as many checks on user input. Bad input could crash R.
NeworderPruningwise(nTip, nNode, parent, child, nEdge)NeworderPhylo(nTip, parent, child, nEdge, whichwise)
NeworderPruningwise
returns an integer vector specifying the
pruningwise order of edges within a tree.
NeworderPhylo
returns an integer vector specifying the order
of edges under the ordering sequence specified by whichwise
.
Integer specifying the number of tips, nodes and edges in the input tree.
Integer vector corresponding to the first column of the edge
matrix of a tree of class phylo
, i.e.
tree[["edge"]][, 1]
Integer vector corresponding to the second column of the edge
matrix of a tree of class phylo
, i.e.
tree[["edge"]][, 2]
.
Integer specifying whether to order edges (1) cladewise; or (2) in postorder.
C algorithm: Emmanuel Paradis
R wrapper: Martin R. Smith
Other C wrappers:
RenumberTree()
nTip <- 8L
tree <- BalancedTree(nTip)
edge <- tree[["edge"]]
pruningwise <- NeworderPruningwise(nTip, tree$Nnode, edge[, 1], edge[, 2],
dim(edge)[1])
cladewise <- NeworderPhylo(nTip, edge[, 1], edge[, 2], dim(edge)[1], 1L)
postorder <- NeworderPhylo(nTip, edge[, 1], edge[, 2], dim(edge)[1], 2L)
tree[["edge"]] <- tree[["edge"]][pruningwise, ]
Run the code above in your browser using DataLab