class_docstr: Mixin for radius-based neighbors searches
docstr: Computes the (weighted) graph of Neighbors for points in X
  
  Neighborhoods are restricted the points at a distance lower than
  radius.
  
  Parameters
  ----------
  X : array-like, shape = [n_samples, n_features], optional
      The query point or points.
      If not provided, neighbors of each indexed point are returned.
      In this case, the query point is not considered its own neighbor.
  
  radius : float
      Radius of neighborhoods.
      (default is the value passed to the constructor).
  
  mode : {'connectivity', 'distance'}, optional
      Type of returned matrix: 'connectivity' will return the
      connectivity matrix with ones and zeros, in 'distance' the
      edges are Euclidean distance between points.
  
  Returns
  -------
  A : sparse matrix in CSR format, shape = [n_samples, n_samples]
      A[i, j] is assigned the weight of edge that connects i to j.
  
  Examples
  --------
  >>> X = [[0], [3], [1]]
  >>> from sklearn.neighbors import NearestNeighbors
  >>> neigh = NearestNeighbors(radius=1.5)
  >>> neigh.fit(X) # doctest: +ELLIPSIS
  NearestNeighbors(algorithm='auto', leaf_size=30, ...)
  >>> A = neigh.radius_neighbors_graph(X)
  >>> A.toarray()
  array([[ 1.,  0.,  1.],
         [ 0.,  1.,  0.],
         [ 1.,  0.,  1.]])
  
  See also
  --------
  kneighbors_graph
docstr_tok: ["Computes","the","(","weighted",")","graph","of","Neighbors","for","points","in","X","Neighborhoods","are","restricted","the","points","at","a","distance","lower","than","radius",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","[","n_samples",",","n_features","]",",","optional","The","query","point","or","points",".","If","not","provided",",","neighbors","of","each","indexed","point","are","returned",".","In","this","case",",","the","query","point","is","not","considered","its","own","neighbor",".","radius",":","float","Radius","of","neighborhoods",".","(","default","is","the","value","passed","to","the","constructor",")",".","mode",":","{","'connectivity","'",",","'distance","'","}",",","optional","Type","of","returned","matrix",":","'connectivity","'","will","return","the","connectivity","matrix","with","ones","and","zeros",",","in","'distance","'","the","edges","are","Euclidean","distance","between","points",".","Returns","--","--","--","-","A",":","sparse","matrix","in","CSR","format",",","shape","=","[","n_samples",",","n_samples","]","A","[","i",",","j","]","is","assigned","the","weight","of","edge","that","connects","i","to","j",".","Examples","--","--","--","--",">",">",">","X","=","[","[","0","]",",","[","3","]",",","[","1","]","]",">",">",">","from","sklearn.neighbors","import","NearestNeighbors",">",">",">","neigh","=","NearestNeighbors","(","radius=1.5",")",">",">",">","neigh.fit","(","X",")","#","doctest",":","+ELLIPSIS","NearestNeighbors","(","algorithm='auto","'",",","leaf_size=30",",","...",")",">",">",">","A","=","neigh.radius_neighbors_graph","(","X",")",">",">",">","A.toarray","(",")","array","(","[","[","1.",",","0.",",","1",".","]",",","[","0.",",","1.",",","0",".","]",",","[","1.",",","0.",",","1",".","]","]",")","See","also","--","--","--","--","kneighbors_graph"]
code: def radius_neighbors_graph(
      self, X=None, radius=None, mode="connectivity"
  ):
      """Computes the (weighted) graph of Neighbors for points in X
  
      Neighborhoods are restricted the points at a distance lower than
      radius.
  
      Parameters
      ----------
      X : array-like, shape = [n_samples, n_features], optional
          The query point or points.
          If not provided, neighbors of each indexed point are returned.
          In this case, the query point is not considered its own neighbor.
  
      radius : float
          Radius of neighborhoods.
          (default is the value passed to the constructor).
  
      mode : {'connectivity', 'distance'}, optional
          Type of returned matrix: 'connectivity' will return the
          connectivity matrix with ones and zeros, in 'distance' the
          edges are Euclidean distance between points.
  
      Returns
      -------
      A : sparse matrix in CSR format, shape = [n_samples, n_samples]
          A[i, j] is assigned the weight of edge that connects i to j.
  
      Examples
      --------
      >>> X = [[0], [3], [1]]
      >>> from sklearn.neighbors import NearestNeighbors
      >>> neigh = NearestNeighbors(radius=1.5)
      >>> neigh.fit(X) # doctest: +ELLIPSIS
      NearestNeighbors(algorithm='auto', leaf_size=30, ...)
      >>> A = neigh.radius_neighbors_graph(X)
      >>> A.toarray()
      array([[ 1.,  0.,  1.],
             [ 0.,  1.,  0.],
             [ 1.,  0.,  1.]])
  
      See also
      --------
      kneighbors_graph
      """
      if X is not None:
          X = check_array(X, accept_sparse=["csr", "csc", "coo"])
  
      n_samples2 = self._fit_X.shape[0]
      if radius is None:
          radius = self.radius
  
      # construct CSR matrix representation of the NN graph
      if mode == "connectivity":
          A_ind = self.radius_neighbors(
              X, radius, return_distance=False
          )
          A_data = None
      elif mode == "distance":
          dist, A_ind = self.radius_neighbors(
              X, radius, return_distance=True
          )
          A_data = np.concatenate(list(dist))
      else:
          raise ValueError(
              'Unsupported mode, must be one of "connectivity", '
              'or "distance" but got %s instead' % mode
          )
  
      n_samples1 = A_ind.shape[0]
      n_neighbors = np.array([len(a) for a in A_ind])
      A_ind = np.concatenate(list(A_ind))
      if A_data is None:
          A_data = np.ones(len(A_ind))
      A_indptr = np.concatenate(
          (np.zeros(1, dtype=int), np.cumsum(n_neighbors))
      )
  
      return csr_matrix(
          (A_data, A_ind, A_indptr), shape=(n_samples1, n_samples2)
      )
  
imports: import warnings
  from abc import ABCMeta, abstractmethod
  import numpy
  from scipy.sparse import csr_matrix, issparse
  from .ball_tree import BallTree
  from .kd_tree import KDTree
  from ..base import BaseEstimator
  from ..metrics import pairwise_distances
  from ..metrics.pairwise import PAIRWISE_DISTANCE_FUNCTIONS
  from ..utils import check_X_y, check_array, _get_n_jobs, gen_even_slices
  from ..utils.fixes import argpartition
  from ..utils.multiclass import check_classification_targets
  from ..externals import six
  from ..externals.joblib import Parallel, delayed
  from ..exceptions import NotFittedError
  from ..exceptions import DataConversionWarning
label_desc: Use image node_id 2 for calling the RadiusNeighborsMixin obj's underlying member method code with example usage: obj.radius_neighbors_graph(X, radius, mode) and returns: csr_matrix