def radius_neighbors_graph(X, radius, mode='connectivity', metric='minkowski', p=2, metric_params=None, include_self=False, n_jobs=1):
 if (not isinstance(X, RadiusNeighborsMixin)):
  X = NearestNeighbors(radius=radius, metric=metric, p=p, metric_params=metric_params, n_jobs=n_jobs).fit(X)
 else:
  _check_params(X, metric, p, metric_params)
 query = _query_include_self(X, include_self)
 return X.radius_neighbors_graph(query, radius, mode)

def radius_neighbors_graph ( X , radius , mode = 'connectivity' , metric = 'minkowski' , p = 2 , metric_params = None , include_self = False , n_jobs = 1 ) : if ( not isinstance ( X , RadiusNeighborsMixin ) ) : X = NearestNeighbors ( radius = radius , metric = metric , p = p , metric_params = metric_params , n_jobs = n_jobs ) . fit ( X ) else : _check_params ( X , metric , p , metric_params ) query = _query_include_self ( X , include_self ) return X . radius_neighbors_graph ( query , radius , mode )
computes the graph of neighbors for points in x neighborhoods are restricted the points at a distance lower than radius .