sklearn.neighbors.NearestNeighbors - knn for unsupervised learning? From basic theory I know that knn is a supervised algorithm while for example k-means is an unsupervised algorithm.

However, at Sklearn there are is an implementation of KNN for unsupervised learning (http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.NearestNeighbors.html#sklearn.neighbors.NearestNeighbors).

What is exactly this unsupervised version of knn at SkLearn?

Is this a knn algorithm? 


If yes how it is unsupervised since by definition knn is supervised?
If no what is it then?
The unsupervised version simply implements different algorithms to find the nearest neighbor(s) for each sample. 

The kNN algorithm consists of two steps:


Compute and store the k nearest neighbors for each sample in the training set ("training") 
For an unlabeled sample, retrieve the k nearest neighbors from dataset and predict label through majority vote / interpolation (or similar) among k nearest neighbors ("prediction/querying")


The unsupervised version is basically only step 1, the training phase of the kNN algorithm. 

(This is useful because if your dataset is large, a pairwise comparison for all samples (algorithm='brute') is often infeasible. Therefore two alternative algorithms for the training stage are implemented that make use of previous comparisons to reduce the number of distance calculations. See the documentation here.)