ape (version 3.4)

nodepath: Find Paths of Nodes

Description

This function finds paths of nodes in a tree. The nodes can be internal and/or terminal (i.e., tips).

Usage

nodepath(phy, from = NULL, to = NULL)

Arguments

phy
an object of class "phylo".
from, to
integers giving node or tip numbers.

Value

  • a list of vectors of integers (by default), or a single vector of integers.

Details

By default, this function returns all the paths from the root to each tip of the tree. If both arguments from and to are specified, the shortest path of nodes linking them is returned.

See Also

getMRCA

Examples

Run this code
tr <- rtree(2)
nodepath(tr)
nodepath(tr, 1, 2)

Run the code above in your browser using DataCamp Workspace