sklearn.neighbors.kneighbors_graph(X, n_neighbors, mode='connectivity', metric='minkowski', p=2, metric_params=None, include_self=False, n_jobs=1) [source]
Computes the (weighted) graph of k-Neighbors for points in X Read more in the User Guide. Parameters:
X : array-like or BallTree, shape = [n_samples, n_features] Sample data, in the form of a numpy array or a precomputed BallTree. n_neighbors : int Number of neighbors for each sample. mode : {?connectivity?, ?distance?}, optional T