Abstracting out KNN and Graph stuff.