skbio.tree.TreeNode.tips#

TreeNode.tips(include_self=False)[source]#

Iterate over tips descended from the current node.

Parameters:
include_selfbool, optional

Whether to include the initial node if it is a tip (default: False).

Yields:
TreeNode

Visited tip.

See also

non_tips
postorder

Notes

Nodes are ordered by a postorder traversal of the tree. The order is consistent between calls.

Examples

>>> from skbio import TreeNode
>>> tree = TreeNode.read(["((a,b)c,(d,e)f);"])
>>> print(tree.ascii_art())
                    /-a
          /c-------|
         |          \-b
---------|
         |          /-d
          \f-------|
                    \-e
>>> for node in tree.tips():
...     print(node.name)
a
b
d
e