skbio.tree.TreeNode.append

TreeNode.append(node)[source]

Appends a node to children, in-place, cleaning up refs

State: Experimental as of 0.4.0.

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

node (TreeNode) – 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;