Skip to main content
`Ctrl`+`K`

# skbio.tree.TreeNode.remove

TreeNode.remove(node, uncache=True)

  Remove a child node by identity from self.

  Parameters:
    node TreeNode

      The node to remove from self’s children.

    uncache bool, optional

      Whether to clear caches of the tree if present (default: True). See `details`.

      Added in version 0.6.3.

  Returns:
    bool

      True if the node was removed. False if the node is not a child of self.

  See also

  `pop`
  `remove_by_func`

  Notes

  The parent of the removed node will be set to None. The removed node and its children (if any) still exist, but are disconnected from the tree. Therefore, this method is useful for detaching a clade from a tree.

  Examples

      >>> from skbio import TreeNode
      >>> tree = TreeNode.read(["(a,b)c;"])
      >>> tree.remove(tree.children[0])
      True