title: Clustering with a distance matrix
body: <p>I have a (symmetric) matrix <code>M</code> that represents the distance between each pair of nodes. For example,</p>
  
  <pre>
      A   B   C   D   E   F   G   H   I   J   K   L
  A   0  20  20  20  40  60  60  60 100 120 120 120
  B  20   0  20  20  60  80  80  80 120 140 140 140
  C  20  20   0  20  60  80  80  80 120 140 140 140
  D  20  20  20   0  60  80  80  80 120 140 140 140
  E  40  60  60  60   0  20  20  20  60  80  80  80
  F  60  80  80  80  20   0  20  20  40  60  60  60
  G  60  80  80  80  20  20   0  20  60  80  80  80
  H  60  80  80  80  20  20  20   0  60  80  80  80
  I 100 120 120 120  60  40  60  60   0  20  20  20
  J 120 140 140 140  80  60  80  80  20   0  20  20
  K 120 140 140 140  80  60  80  80  20  20   0  20
  L 120 140 140 140  80  60  80  80  20  20  20   0
  </pre>
  
  <p>Is there any method to extract clusters from <code>M</code> (if needed, the number of clusters can be fixed), such that each cluster contains nodes with small distances between them. In the example, the clusters would be <code>(A, B, C, D)</code>, <code>(E, F, G, H)</code> and <code>(I, J, K, L)</code>.</p>
  
  <p>Thanks a lot :)</p>