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

skbio.tree.TreeNode.non_tips#

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

Iterate over nontips descended from self.

include_self, if True (default is False), will return the current node as part of non_tips if it is a non_tip. Node order is consistent between calls and is ordered by a postorder traversal of the tree.

Parameters:
include_selfbool

include the initial node if True

Yields:
TreeNode

Traversed node.

Examples

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