skbio.core.tree.TreeNode.levelorder

TreeNode.levelorder(include_self=True)[source]

Performs levelorder iteration over tree

Parameters:

include_self : bool

include the initial node if True

Returns:

GeneratorType

Yields successive TreeNode objects

Examples

>>> from skbio.core.tree import TreeNode
>>> tree = TreeNode.from_newick("((a,b)c,(d,e)f);")
>>> for node in tree.levelorder():
...     print node.name
None
c
f
a
b
d
e