Efficient k-nearest neighbor graph construction for generic similarity measures | Synapse