Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

shortestPath-methods

shortestPath-methods


Description

Finds the shortest path between two nodes in a tree

Usage

shortestPath(x, node1, node2)

## S4 method for signature 'phylo4'
shortestPath(x, node1, node2)

## S4 method for signature 'phylo'
shortestPath(x, node1, node2)

Arguments

x

a tree in the phylo4, phylo4d or phylo format

node1

a numeric or character (passed to getNode) indicating the beginning from which the path should be calculated.

node2

a numeric or character (passed to getNode) indicating the end of the path.

Details

Given two nodes (i.e, tips or internal nodes), this function returns the shortest path between them (excluding node1 and node2 as a vector of nodes.

Value

a vector of nodes indcating the shortest path between 2 nodes

See Also

getNode


phylobase

Base Package for Phylogenetic Structures and Comparative Data

v0.8.10
GPL (>= 2)
Authors
R Hackathon et al. (alphabetically: Ben Bolker, Marguerite Butler, Peter Cowan, Damien de Vienne, Dirk Eddelbuettel, Mark Holder, Thibaut Jombart, Steve Kembel, Francois Michonneau, David Orme, Brian O'Meara, Emmanuel Paradis, Jim Regetz, Derrick Zwickl)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.