code: def _rsl_generic(
      X, k=5, alpha=1.4142135623730951, metric="euclidean", **kwargs
  ):
      distance_matrix = pairwise_distances(X, metric=metric, **kwargs)
  
      mutual_reachability_ = mutual_reachability(distance_matrix, k)
  
      min_spanning_tree = mst_linkage_core(mutual_reachability_)
      min_spanning_tree = min_spanning_tree[
          np.argsort(min_spanning_tree.T[2]), :
      ]
  
      single_linkage_tree = label(min_spanning_tree)
      single_linkage_tree = SingleLinkageTree(single_linkage_tree)
  
      return single_linkage_tree
  
imports: import numpy
  from sklearn.base import BaseEstimator, ClusterMixin
  from sklearn.metrics import pairwise_distances
  from scipy.sparse import issparse
  from joblib import Memory
  from sklearn.utils import check_array
  from ._hdbscan_linkage import mst_linkage_core, mst_linkage_core_vector, label
  from ._hdbscan_boruvka import KDTreeBoruvkaAlgorithm, BallTreeBoruvkaAlgorithm
  from .dist_metrics import DistanceMetric
  from ._hdbscan_reachability import mutual_reachability
  from .plots import SingleLinkageTree
  from sklearn.neighbors import KDTree, BallTree
  from warnings import warn
label_desc: Use image node_id 1 for calling a global function with example usage: _rsl_generic(X, k, alpha, metric) and returns: single_linkage_tree