scikit-bio is back in active development! Check out our announcement of revitalization.

skbio.tree.TreeNode.get_max_distance#

TreeNode.get_max_distance()[source]#

Return the max tip tip distance between any pair of tips.

Returns:
float

The distance between the two most distant tips in the tree

tuple of TreeNode

The two most distant tips in the tree

Raises:
NoLengthError

A NoLengthError will be thrown if a node without length is encountered

Examples

>>> from skbio import TreeNode
>>> tree = TreeNode.read(["((a:1,b:2)c:3,(d:4,e:5)f:6)root;"])
>>> dist, tips = tree.get_max_distance()
>>> dist
16.0
>>> [n.name for n in tips]
['b', 'e']