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

skbio.tree.TreeNode.root#

TreeNode.root()[source]#

Return root of the tree which contains self.

Returns:
TreeNode

The root of the tree

Examples

>>> from skbio import TreeNode
>>> tree = TreeNode.read(["((a,b)c,(d,e)f)root;"])
>>> tip_a = tree.find('a')
>>> root = tip_a.root()
>>> root == tree
True