skbio.tree.TreeNode.distance¶

TreeNode.distance(other)[source]

Return the distance between self and other

State: Experimental as of 0.4.0.

This method can be used to compute the distances between two tips, however, it is not optimized for computing pairwise tip distances.

Parameters

other (TreeNode) – The node to compute a distance to

Returns

The distance between two nodes

Return type

float

Raises

NoLengthError – A NoLengthError will be raised if a node without length is encountered

Examples

>>> from skbio import TreeNode
>>> tip_a = tree.find('a')
>>> tip_d = tree.find('d')
>>> tip_a.distance(tip_d)
14.0