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

skbio.tree.TreeNode.append#

TreeNode.append(node)[source]#

Append a node to children, in-place, cleaning up refs.

append will invalidate any node lookup caches, remove an existing parent on node if one exists, set the parent of node to self and add the node to self children.

Parameters:
nodeTreeNode

An existing TreeNode object

See also

extend

Examples

>>> from skbio import TreeNode
>>> root = TreeNode(name="root")
>>> child1 = TreeNode(name="child1")
>>> child2 = TreeNode(name="child2")
>>> root.append(child1)
>>> root.append(child2)
>>> print(root)
(child1,child2)root;