code: def _extend_condensed_tree(
      tree,
      neighbor_indices,
      neighbor_distances,
      core_distances,
      min_samples,
  ):
      """
      Create a new condensed tree with an additional point added, allowing for
      computations as if this point had been part of the original tree. Note
      that this makes as little change to the tree as possible, with no
      re-optimizing/re-condensing so that the selected clusters remain
      effectively unchanged.
  
      Parameters
      ----------
      tree : structured array
          The raw format condensed tree to update.
  
      neighbor_indices : array (2 * min_samples, )
          An array of raw distance based nearest neighbor indices.
  
      neighbor_distances : array (2 * min_samples, )
          An array of raw distances to the nearest neighbors.
  
      core_distances : array (n_samples, )
          An array of core distances for all points
  
      min_samples : int
          The min_samples value used to generate core distances.
  
      Returns
      -------
      new_tree : structured array
          The original tree with an extra row providing the parent cluster
          and lambda information for a new point given index -1.
      """
      tree_root = tree["parent"].min()
  
      nearest_neighbor, lambda_ = _find_neighbor_and_lambda(
          neighbor_indices,
          neighbor_distances,
          core_distances,
          min_samples,
      )
  
      neighbor_tree_row = get_tree_row_with_child(
          tree, nearest_neighbor
      )
      potential_cluster = neighbor_tree_row["parent"]
  
      if neighbor_tree_row["lambda_val"] <= lambda_:
          # New point departs with the old
          new_tree_row = (
              potential_cluster,
              -1,
              1,
              neighbor_tree_row["lambda_val"],
          )
      else:
          # Find appropriate cluster based on lambda of new point
          while (
              potential_cluster > tree_root
              and tree[tree["child"] == potential_cluster]["lambda_val"]
              >= lambda_
          ):
              potential_cluster = tree["parent"][
                  tree["child"] == potential_cluster
              ][0]
  
          new_tree_row = (potential_cluster, -1, 1, lambda_)
  
      return np.append(tree, new_tree_row)
  
file_path: hdbscan/hdbscan/prediction.py
imports: import numpy
  from sklearn.neighbors import KDTree, BallTree
  from .dist_metrics import DistanceMetric
  from ._hdbscan_tree import recurse_leaf_dfs
  from ._prediction_utils import get_tree_row_with_child, dist_membership_vector, outlier_membership_vector, prob_in_some_cluster, all_points_dist_membership_vector, all_points_outlier_membership_vector, all_points_prob_in_some_cluster
  from warnings import warn
label_desc: Use image node_id 2 for calling a global function with example usage: _extend_condensed_tree(tree, neighbor_indices, neighbor_distances, core_distances, min_samples) and returns: np