skbio.tree.TreeNode.is_root

TreeNode.is_root()[source]

Returns True if the current is a root, i.e. has no parent.

Returns:

bool

True if the node is the root

See also

is_tip, has_children

Examples

>>> from six import StringIO
>>> from skbio import TreeNode
>>> tree = TreeNode.read(StringIO("((a,b)c);"))
>>> print(tree.is_root())
True
>>> print(tree.find('a').is_root())
False