TreeTools (version 0.1.3)

Neworder: Reorder edges of a phylogenetic tree

Description

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.

Usage

NeworderPruningwise(nTip, nNode, parent, child, nEdge)

NeworderPhylo(nTip, parent, child, nb.edge, whichwise)

Arguments

nTip, nNode, nEdge

Integer specifying the number of tips, nodes and edges in the input tree.

parent

the first column of the edge matrix of a tree of class phylo, i.e. tree$edge[, 1].

child

the second column of the edge matrix of a tree of class phylo, i.e. tree$edge[, 2].

`whichwise`

Integer specifying whether to order edges (1) cladewise; or (2) in postorder.

Value

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.

See Also

Other C wrappers: Cladewise, RenumberTree

Examples

Run this code
# NOT RUN {
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 DataCamp Workspace