def remove_child(node)
      unless (index = search_node_index(node))
        PEROBS.log.fatal "Cannot remove child #{node._id} from node #{@_id}"
      end

      if index == 0
        # Removing the first child is a bit more complicated as the
        # corresponding branch key is in a parent node.
        key = @keys.shift
        update_branch_key(key)
      else
        # For all other children we can just remove the corresponding key.
        @keys.delete_at(index - 1)
      end

      # Remove the child node link.
      child = @children.delete_at(index)
      # If we remove the first or last leaf node we must update the reference
      # in the BigTree object.
      @tree.first_leaf = child.next_sibling if child == @tree.first_leaf
      @tree.last_leaf = child.prev_sibling if child == @tree.last_leaf
      # Unlink the neighbouring siblings from the child
      child.prev_sibling.next_sibling = child.next_sibling if child.prev_sibling
      child.next_sibling.prev_sibling = child.prev_sibling if child.next_sibling

      if @keys.length < min_keys
        # The node has become too small. Try borrowing a node from an adjecent
        # sibling or merge with an adjecent node.
        if @prev_sibling && @prev_sibling.parent == @parent
          borrow_from_previous_sibling(@prev_sibling) ||
            @prev_sibling.merge_with_branch_node(myself)
        elsif @next_sibling && @next_sibling.parent == @parent
          borrow_from_next_sibling(@next_sibling) ||
            merge_with_branch_node(@next_sibling)
        end
      end

      if @parent.nil? && @children.length <= 1
        # If the node just below the root only has one child it will become
        # the new root node.
        new_root = @children.first
        new_root.parent = nil
        @tree.root = new_root
      end
    end
def remove_child(node)
      unless (index = search_node_index(node))
        PEROBS.log.fatal "Cannot remove child #{node._id} from node #{@_id}"
      end

      if index == 0
        # Removing the first child is a bit more complicated as the
        # corresponding branch key is in a parent node.
        key = @keys.shift
        update_branch_key(key)
      else
        # For all other children we can just remove the corresponding key.
        @keys.delete_at(index - 1)
      end

      # Remove the child node link.
      child = @children.delete_at(index)
      # If we remove the first or last leaf node we must update the reference
      # in the BigTree object.
      @tree.first_leaf = child.next_sibling if child == @tree.first_leaf
      @tree.last_leaf = child.prev_sibling if child == @tree.last_leaf
      # Unlink the neighbouring siblings from the child
      child.prev_sibling.next_sibling = child.next_sibling if child.prev_sibling
      child.next_sibling.prev_sibling = child.prev_sibling if child.next_sibling

      if @keys.length < min_keys
        # The node has become too small. Try borrowing a node from an adjecent
        # sibling or merge with an adjecent node.
        if @prev_sibling && @prev_sibling.parent == @parent
          borrow_from_previous_sibling(@prev_sibling) ||
            @prev_sibling.merge_with_branch_node(myself)
        elsif @next_sibling && @next_sibling.parent == @parent
          borrow_from_next_sibling(@next_sibling) ||
            merge_with_branch_node(@next_sibling)
        end
      end

      if @parent.nil? && @children.length <= 1
        # If the node just below the root only has one child it will become
        # the new root node.
        new_root = @children.first
        new_root.parent = nil
        @tree.root = new_root
      end
    end
Remove the specified node from this branch node.
 @param node [BigTreeNode] The child to remove