parameters: (self, X=None, radius=None, mode='connectivity',
                                 sort_results=False)
return_statement: return csr_matrix((A_data, A_ind, A_indptr),
                            shape=(n_queries, n_samples_fit))
docstring: 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 of shape (n_samples, n_features), default=None
              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.
  
          sort_results : boolean, optional. Defaults to False.
              If True, the distances and indices will be sorted before being
              returned. If False, the results will not be sorted.
              Only used with mode='distance'.
  
              .. versionadded:: 0.22
  
          Returns
          -------
          A : sparse graph in CSR format, shape = [n_queries, n_samples_fit]
              n_samples_fit is the number of samples in the fitted data
              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)
          NearestNeighbors(radius=1.5)
          >>> A = neigh.radius_neighbors_graph(X)
          >>> A.toarray()
          array([[1., 0., 1.],
                 [0., 1., 0.],
                 [1., 0., 1.]])
  
          See also
          --------
          kneighbors_graph
docstring_summary: Computes the (weighted) graph of Neighbors for points in X
docstring_tokens: Computes the ( weighted ) graph of Neighbors for points in X
function: def radius_neighbors_graph(self, X=None, radius=None, mode='connectivity',
                                 sort_results=False):
          """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 of shape (n_samples, n_features), default=None
              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.
  
          sort_results : boolean, optional. Defaults to False.
              If True, the distances and indices will be sorted before being
              returned. If False, the results will not be sorted.
              Only used with mode='distance'.
  
              .. versionadded:: 0.22
  
          Returns
          -------
          A : sparse graph in CSR format, shape = [n_queries, n_samples_fit]
              n_samples_fit is the number of samples in the fitted data
              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)
          NearestNeighbors(radius=1.5)
          >>> A = neigh.radius_neighbors_graph(X)
          >>> A.toarray()
          array([[1., 0., 1.],
                 [0., 1., 0.],
                 [1., 0., 1.]])
  
          See also
          --------
          kneighbors_graph
          """
          check_is_fitted(self)
  
          # check the input only in self.radius_neighbors
  
          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,
                                                  sort_results=sort_results)
              A_data = np.concatenate(list(dist))
          else:
              raise ValueError(
                  'Unsupported mode, must be one of "connectivity", '
                  'or "distance" but got %s instead' % mode)
  
          n_queries = A_ind.shape[0]
          n_samples_fit = self.n_samples_fit_
          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_queries, n_samples_fit))
function_tokens: def radius_neighbors_graph ( self , X = None , radius = None , mode = 'connectivity' , sort_results = False ) : check_is_fitted ( self ) # check the input only in self.radius_neighbors 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 , sort_results = sort_results ) A_data = np . concatenate ( list ( dist ) ) else : raise ValueError ( 'Unsupported mode, must be one of "connectivity", ' 'or "distance" but got %s instead' % mode ) n_queries = A_ind . shape [ 0 ] n_samples_fit = self . n_samples_fit_ 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_queries , n_samples_fit ) )