skbio.tree.TreeNode.is_root#
- TreeNode.is_root()[source]#
Check if the current node is the root of a tree.
- Returns:
- bool
Whether the node is the root.
See also
Notes
A root is defined as a node that has no
parent
. A tree has exactly one root.Examples
>>> from skbio import TreeNode >>> tree = TreeNode.read(["((a,b)c);"]) >>> print(tree.is_root()) True >>> print(tree.find('a').is_root()) False