TreeNode.
postorder
(include_self=True)[source]¶Performs postorder iteration over tree.
State: Experimental as of 0.4.0.
This is somewhat inelegant compared to saving the node and its index on the stack, but is 30% faster in the average case and 3x faster in the worst case (for a comb tree).
include_self (bool) – include the initial node if True
TreeNode – Traversed node.
See also
traverse()
, preorder()
, pre_and_postorder()
, levelorder()
, tips()
, non_tips()
Examples
>>> from skbio import TreeNode
>>> tree = TreeNode.read(["((a,b)c);"])
>>> for node in tree.postorder():
... print(node.name)
a
b
c
None