EdgeAncestry: Ancestors of an edge

View source: R/tree_ancestors.R

EdgeAncestryR Documentation

Ancestors of an edge

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

Integer vector corresponding to the first column of the edge matrix of a tree of class phylo, i.e. tree[["edge"]][, 1]

child

Integer vector corresponding to the second column of the edge matrix of a tree of class phylo, i.e. tree[["edge"]][, 2].

stopAt

Integer or logical vector specifying the edge(s) at which to terminate the search; defaults to the edges with the smallest parent, which will be the root edges if nodes are numbered Cladewise or in Preorder.

Value

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

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

See Also

Other tree navigation: AncestorEdge(), CladeSizes(), DescendantEdges(), EdgeDistances(), ListAncestors(), MRCA(), MatchEdges(), NDescendants(), NodeDepth(), NodeNumbers(), NodeOrder(), RootNode()

Examples

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))


TreeTools documentation built on June 22, 2024, 9:27 a.m.