modify knnsearch for single graph