nodepath: Find Paths of Nodes

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/nodepath.R

Description

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

Usage

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

Arguments

phy

an object of class "phylo".

from, to

integers giving node or tip numbers.

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.

Value

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

Author(s)

Emmanuel Paradis

See Also

getMRCA

Examples

1
2
3
tr <- rtree(2)
nodepath(tr)
nodepath(tr, 1, 2)

Example output

[[1]]
[1] 3 1

[[2]]
[1] 3 2

[1] 1 3 2

ape documentation built on April 5, 2018, 1:03 a.m.