Points x and y are specified as vectors of IDs corresponding to
nodes in a tree, starting with the root node and ending at the leaf
node. The distance between two points is defined as the number of
edges between the leaves and their nearest common ancestor.
If x and y have different roots (i.e., points are not from the
same tree, then the length of the points is returned.
Parameters:
x (1D numpy.ndarray) – Current point.
y (1D numpy.ndarray) – Nearby point.
Returns:
Tree distance between x and y.
Return type:
nonnegative numpy.float32
Examples
Get tree distances between leaf nodes from the following tree.