skbio.tree.TreeNode.extend#

TreeNode.extend(nodes)[source]#

Add a list of nodes to self’s children.

Parameters:
nodeslist of TreeNode

Nodes to add as children.

See also

append

Notes

extend will invalidate any node lookup caches, remove existing parents of the nodes if they have any, set their parents to self and add the nodes to the children of self.

Examples

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