Delete node p, and then rebalance the tree.
193979
private void deleteEntry(TreeMapEntry<K,V> p) {
        modCount++;
        size--;

        // If strictly internal, copy successor's element to p and then make p
        // point to successor.
        if (p.left != null && p.right != null) {
            TreeMapEntry<K,V> s = successor(p);
            p.key = s.key;
            p.value = s.value;
            p = s;
        } // p has 2 children

        // Start fixup at replacement node, if it exists.
        TreeMapEntry<K,V> replacement = (p.left != null ? p.left : p.right);

        if (replacement != null) {
            // Link replacement to parent
            replacement.parent = p.parent;
            if (p.parent == null)
                root = replacement;
            else if (p == p.parent.left)
                p.parent.left  = replacement;
            else
                p.parent.right = replacement;

            // Null out links so they are OK to use by fixAfterDeletion.
            p.left = p.right = p.parent = null;

            // Fix replacement
            if (p.color == BLACK)
                fixAfterDeletion(replacement);
        } else if (p.parent == null) { // return if we are the only node.
            root = null;
        } else { //  No children. Use self as phantom replacement and unlink.
            if (p.color == BLACK)
                fixAfterDeletion(p);

            if (p.parent != null) {
                if (p == p.parent.left)
                    p.parent.left = null;
                else if (p == p.parent.right)
                    p.parent.right = null;
                p.parent = null;
            }
        }
    }
830648
async def delete_tree(self, prefix, *, separator=None):
        
        response = await self._discard(prefix,
                                       recurse=True,
                                       separator=separator)
        return response.body is True
1095372
def _prune(self):
        
        done = False
        while not done:
            done = True
            for node in [node for node in self.nodes.values() if node.intermediate]:
                if not [dep for dep in self.nodes.values() if dep.previous == node.volume]:
                    # logger.debug("Removing unnecessary node %s", node)
                    del self.nodes[node.volume]
                    done = False
68662
private boolean rebalance(final NodeInterval newNode) {

        NodeInterval prevRebalanced = null;
        NodeInterval curChild = leftChild;
        List<NodeInterval> toBeRebalanced = Lists.newLinkedList();
        do {
            if (curChild.isItemOverlap(newNode)) {
                toBeRebalanced.add(curChild);
            } else {
                if (toBeRebalanced.size() > 0) {
                    break;
                }
                prevRebalanced = curChild;
            }
            curChild = curChild.rightSibling;
        } while (curChild != null);

        if (toBeRebalanced.isEmpty()) {
            return false;
        }

        newNode.parent = this;
        final NodeInterval lastNodeToRebalance = toBeRebalanced.get(toBeRebalanced.size() - 1);
        newNode.rightSibling = lastNodeToRebalance.rightSibling;
        lastNodeToRebalance.rightSibling = null;
        if (prevRebalanced == null) {
            leftChild = newNode;
        } else {
            prevRebalanced.rightSibling = newNode;
        }

        NodeInterval prev = null;
        for (NodeInterval cur : toBeRebalanced) {
            cur.parent = newNode;
            if (prev == null) {
                newNode.leftChild = cur;
            } else {
                prev.rightSibling = cur;
            }
            prev = cur;
        }
        return true;
    }
431800
def prune(manager: Manager):
    """"""
    nodes_to_delete = [
        node
        for node in tqdm(manager.session.query(Node), total=manager.count_nodes())
        if not node.networks
    ]
    manager.session.delete(nodes_to_delete)
    manager.session.commit()
1056237
def remove_node(self, node):
        
        preds = self.reverse_edges.get(node, [])
        for pred in preds:
            self.edges[pred].remove(node)

        succs = self.edges.get(node, [])
        for suc in succs:
            self.reverse_edges[suc].remove(node)

        exc_preds = self.reverse_catch_edges.pop(node, [])
        for pred in exc_preds:
            self.catch_edges[pred].remove(node)

        exc_succs = self.catch_edges.pop(node, [])
        for suc in exc_succs:
            self.reverse_catch_edges[suc].remove(node)

        self.nodes.remove(node)
        if node in self.rpo:
            self.rpo.remove(node)
        del node
411757
private final V remove_node(BinTreeNode<K,V> node, BinTreeNode<K,V> prev, int son) {
	if(node.left == null)
	    return remove_semi_leaf(node, prev, son, node.right);
	if(node.right == null)
	    return remove_semi_leaf(node, prev, son, node.left);

	// The BinTreeNode to replace node in the tree. This is either the
	// next or the precedent node (in the order of the hashCode's.
	// We decide a bit randomly, to gain some balanceness.
	BinTreeNode<K,V> m = 
	    (node.keyHashCode % 2 == 0) ?
	    extract_next(node) : extract_prev(node);

	return finish_removal(node, prev, son, m);
    }
624091
private final V finish_removal(BinTreeNode<K,V> node, BinTreeNode<K,V> prev,
				   int son, BinTreeNode<K,V> m) {
	if(m != null) { // set up the links for m
	    m.left  = node.left;
	    m.right = node.right;
	}
	if(prev == null)
	    root = m;
	else {
	    if(son == 0)
		prev.left = m;
	    else
		prev.right = m;
	}

	return node.value;
    }
540171
def delete_node(self, node_id):
        """"""
        node = self.get_node(node_id)

        # Remove all edges from the node
        for e in node['edges']:
            self.delete_edge_by_id(e)

        # Remove all edges to the node
        edges = [edge_id for edge_id, edge in list(self.edges.items()) if edge['vertices'][1] == node_id]
        for e in edges:
            self.delete_edge_by_id(e)

        # Remove the node from the node list
        del self.nodes[node_id]

        self._num_nodes -= 1
1112205
function( nodeStructure, id, parentId, tree, stackParentId ) {
        this.reset( nodeStructure, id, parentId, tree, stackParentId );
    }
644458
def replacenode(self, othereplus, node):
        """"""
        node = node.upper()
        self.dt[node.upper()] = othereplus.dt[node.upper()]
174476
protected void delete(Node<K, V> n) {
        if (n == root) {
            deleteMin();
            return;
        }

        if (n.y_s == null) {
            throw new IllegalArgumentException("Invalid handle!");
        }

        // disconnect and union children of node
        Node<K, V> childTree = unlinkAndUnionChildren(n);

        // find parent
        Node<K, V> p = getParent(n);

        // link children tree in place of node
        if (childTree == null) {
            // no children, just unlink from parent
            if (p.o_c == n) {
                if (n.y_s == p) {
                    p.o_c = null;
                } else {
                    p.o_c = n.y_s;
                }
            } else {
                p.o_c.y_s = p;
            }
        } else {
            // link children tree to parent
            if (p.o_c == n) {
                childTree.y_s = n.y_s;
                p.o_c = childTree;
            } else {
                p.o_c.y_s = childTree;
                childTree.y_s = p;
            }
        }

        size--;
        n.o_c = null;
        n.y_s = null;
    }
751776
def replace(self, new_node):
        """"""
        cur_node = self.cur_node
        nodestack = self.nodestack
        cur = nodestack.pop()
        prev = nodestack[-1]
        index = prev[-1] - 1
        oldnode, name = prev[-2][index]
        assert cur[0] is cur_node is oldnode, (cur[0], cur_node, prev[-2],
                                               index)
        parent = prev[0]
        if isinstance(parent, list):
            parent[index] = new_node
        else:
            setattr(parent, name, new_node)
1106521
private Tree<K, V> del(Tree<K, V> tree, K k) {
        if (tree == null)
            return null;

        int cmp = ordering.compare(k, tree.getKey(kf));
        if (cmp < 0) return delLeft(tree, k);
        else if (cmp > 0) return delRight(tree, k);
        else return append(tree.getLeft(), tree.getRight());
    }
796111
def delete_node(self, node: str):
        
        if self.has_node(node):
            self.remove_node(node)
83434
def _flag_node_as_del_and_del_in_by_target(self, node_id):
        """"""
        self.nodes_deleted.append(node_id)
        etp = self._edge_by_target.get(node_id)
        if etp is not None:
            del self._edge_by_target[node_id]
318124
def delete_node(self, name):
        

        name = self._validate_name(name)
        if name in self.nodes:
            del self.nodes[name]