Here is a C++ implementation of the Dominant Sets clustering algorithm from . It contains both the pairwise clustering and the iterative procedure to obtain multiple clusters.
The original algorithm has been extended in order to handle 3 additional constraints: the maximum cluster size, the minimum cluster size and the number of overlaps per cluster. Overlapping clustering may be useful in some cases: we used it in our paper on 3D reconstruction to create overlaps between camera clusters.
Download the code here and run the demo!
 Pavan, Massimiliano, and Marcello Pelillo. “Dominant sets and pairwise clustering” Pattern Analysis and Machine Intelligence 2007