The "patristic distance" between two tips and/or nodes is the shortest cumulative branch length that must be traversed along the tree in order to reach one tip/node from the other.This function returns a square distance matrix, containing the patristic distance between all possible pairs of tips/nodes in the tree (or among the ones provided in only_clades
).
If tree$edge.length
is missing, then each edge is assumed to be of length 1; this is the same as setting as_edge_counts=TRUE
. The tree may include multi-furcations as well as mono-furcations (i.e. nodes with only one child). The input tree must be rooted at some node for technical reasons (see function root_at_node
), but the choice of the root node does not influence the result. If only_clades
is a character vector, then tree$tip.label
must exist. If node names are included in only_clades
, then tree$node.label
must also exist.
The asymptotic average time complexity of this function for a balanced binary tree is O(NC*NC*Nanc + Ntips), where NC is the number of tips/nodes considered (e.g., the length of only_clades
) and Nanc is the average number of ancestors per tip.