modify knnsearch.getNextVertex's work