code: def _radius_neighbors_from_graph(graph, radius, return_distance):
      """Decompose a nearest neighbors sparse graph into distances and indices.
  
      Parameters
      ----------
      graph : sparse matrix of shape (n_samples, n_samples)
          Neighbors graph as given by `kneighbors_graph` or
          `radius_neighbors_graph`. Matrix should be of format CSR format.
  
      radius : float
          Radius of neighborhoods which should be strictly positive.
  
      return_distance : bool
          Whether or not to return the distances.
  
      Returns
      -------
      neigh_dist : ndarray of shape (n_samples,) of arrays
          Distances to nearest neighbors. Only present if `return_distance=True`.
  
      neigh_ind : ndarray of shape (n_samples,) of arrays
          Indices of nearest neighbors.
      """
      assert graph.format == "csr"
  
      no_filter_needed = bool(graph.data.max() <= radius)
  
      if no_filter_needed:
          data, indices, indptr = (
              graph.data,
              graph.indices,
              graph.indptr,
          )
      else:
          mask = graph.data <= radius
          if return_distance:
              data = np.compress(mask, graph.data)
          indices = np.compress(mask, graph.indices)
          indptr = np.concatenate(([0], np.cumsum(mask)))[graph.indptr]
  
      indices = indices.astype(np.intp, copy=no_filter_needed)
  
      if return_distance:
          neigh_dist = _to_object_array(np.split(data, indptr[1:-1]))
      neigh_ind = _to_object_array(np.split(indices, indptr[1:-1]))
  
      if return_distance:
          return neigh_dist, neigh_ind
      else:
          return neigh_ind
  
imports: import itertools
  import numbers
  import warnings
  from abc import ABCMeta, abstractmethod
  from functools import partial
  from numbers import Integral, Real
  import numpy
  from joblib import effective_n_jobs
  from scipy.sparse import csr_matrix, issparse
  from ..base import BaseEstimator, MultiOutputMixin, is_classifier
  from ..exceptions import DataConversionWarning, EfficiencyWarning
  from ..metrics import pairwise_distances_chunked
  from ..metrics._pairwise_distances_reduction import ArgKmin, RadiusNeighbors
  from ..metrics.pairwise import PAIRWISE_DISTANCE_FUNCTIONS
  from ..utils import _to_object_array, check_array, gen_even_slices
  from ..utils._param_validation import Interval, StrOptions, validate_params
  from ..utils.fixes import parse_version, sp_base_version
  from ..utils.multiclass import check_classification_targets
  from ..utils.parallel import Parallel, delayed
  from ..utils.validation import check_is_fitted, check_non_negative
  from ._ball_tree import BallTree
  from ._kd_tree import KDTree
label_desc: Use image node_id 6 for calling a global function with example usage: _radius_neighbors_from_graph(graph, radius, return_distance) and returns: neigh_dist,  neigh_ind, neigh_ind