code: def distances_between_points(
      X,
      labels,
      cluster_id,
      metric="euclidean",
      d=None,
      no_coredist=False,
      print_max_raw_to_coredist_ratio=False,
      **kwd_args,
  ):
      """
      Compute pairwise distances for all the points of a cluster.
  
      If metric is 'precomputed' then assume X is a distance matrix for the full
      dataset. Note that in this case you must pass in 'd' the dimension of the
      dataset.
  
      Parameters
      ----------
      X : array (n_samples, n_features) or (n_samples, n_samples)
          The input data of the clustering. This can be the data, or, if
          metric is set to `precomputed` the pairwise distance matrix used
          for the clustering.
  
      labels : array (n_samples)
          The label array output by the clustering, providing an integral
          cluster label to each data point, with -1 for noise points.
  
      cluster_id : integer
          The cluster label for which to compute the distances
  
      metric : string
          The metric used to compute distances for the clustering (and
          to be re-used in computing distances for mr distance). If
          set to `precomputed` then X is assumed to be the precomputed
          distance matrix between samples.
  
      d : integer (or None)
          The number of features (dimension) of the dataset. This need only
          be set in the case of metric being set to `precomputed`, where
          the ambient dimension of the data is unknown to the function.
  
      **kwd_args :
          Extra arguments to pass to the distance computation for other
          metrics, such as minkowski, Mahanalobis etc.
  
      Returns
      -------
  
      distances : array (n_samples, n_samples)
          The distances between all points in `X` with `label` equal to `cluster_id`.
  
      core_distances : array (n_samples,)
          The all-points-core_distance of all points in `X` with `label` equal
          to `cluster_id`.
  
      References
      ----------
      Moulavi, D., Jaskowiak, P.A., Campello, R.J., Zimek, A. and Sander, J.,
      2014. Density-Based Clustering Validation. In SDM (pp. 839-847).
      """
      if metric == "precomputed":
          if d is None:
              raise ValueError(
                  "If metric is precomputed a "
                  "d value must be provided!"
              )
          distance_matrix = X[labels == cluster_id, :][
              :, labels == cluster_id
          ]
      else:
          subset_X = X[labels == cluster_id, :]
          distance_matrix = pairwise_distances(
              subset_X, metric=metric, **kwd_args
          )
          d = X.shape[1]
  
      if no_coredist:
          return distance_matrix, None
  
      else:
          core_distances = all_points_core_distance(
              distance_matrix.copy(), d=d
          )
          core_dist_matrix = np.tile(
              core_distances, (core_distances.shape[0], 1)
          )
          stacked_distances = np.dstack(
              [distance_matrix, core_dist_matrix, core_dist_matrix.T]
          )
  
          if print_max_raw_to_coredist_ratio:
              print(
                  "Max raw distance to coredistance ratio: "
                  + str(max_ratio(stacked_distances))
              )
  
          return stacked_distances.max(axis=-1), core_distances
  
file_path: hdbscan/hdbscan/validity.py
imports: import numpy
  from sklearn.metrics import pairwise_distances
  from scipy.spatial.distance import cdist
  from ._hdbscan_linkage import mst_linkage_core
  from .hdbscan_ import isclose
label_desc: Use image node_id 3 for calling a global function with example usage: distances_between_points(X, labels, cluster_id, metric, d, no_coredist, print_max_raw_to_coredist_ratio) and returns: distance_matrix,  None, stacked_distances,  core_distances