skbio.tree.TreeNode.append#

TreeNode.append(node)[source]#

Add a node to self’s children.

Parameters:
nodeTreeNode

Node to add as a child.

See also

extend

Notes

append will invalidate any node lookup caches, remove the node’s parent if it exists, set the parent of node to self, and add the node to self’s children.

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;