TreeTools (version 0.1.3)

EdgeAncestry: Edge ancestry

Description

Quickly identify edges that are 'ancestral' to a particular edge in a tree.

Usage

EdgeAncestry(edge, parent, child, stopAt = (parent == min(parent)))

Arguments

edge

Integer specifying the number of the edge whose child edges should be returned.

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].

stopAt

number of the edge at which the search should terminate; defaults to the root edges.

Value

EdgeAncestry returns a logical vector stating whether each edge in turn is a descendant of the specified edge.

See Also

Other tree navigation: AllAncestors, AncestorEdge, DescendantEdges, EdgeDistances, MRCA, NonDuplicateRoot

Examples

Run this code
# NOT RUN {
tree <- PectinateTree(6)
plot(tree)
ape::edgelabels()
parent <- tree$edge[, 1]
child <- tree$edge[, 2]
EdgeAncestry(7, parent, child)
which(EdgeAncestry(7, parent, child, stopAt = 4))

# }

Run the code above in your browser using DataLab