skbio.tree.TreeNode.pre_and_postorder#
- TreeNode.pre_and_postorder(include_self=True)[source]#
Perform iteration over tree, visiting node before and after.
- Parameters:
- include_selfbool
include the initial node if True
- Yields:
- TreeNode
Traversed node.
Examples
>>> from skbio import TreeNode >>> tree = TreeNode.read(["((a,b)c);"]) >>> for node in tree.pre_and_postorder(): ... print(node.name) None c a b c None