get_root#

biotite.sequence.phylo.get_root(tree: DiGraph) → Any[source]#

Get the root node of a tree.

Parameters:
treeDiGraph

The tree.

Returns:
roothashable

The root node, i.e. the only node without a parent.

Raises:
ValueError

If the tree has not exactly one node without a parent.

Examples

>>> tree = from_newick("((0,1),2);")
>>> print(get_root(tree))
4