Shortest distance clustering