title: Friends-of-friends clustering algorithm (Python)
body: <p>I would like to implement in Python a &quot;friends-of-friends&quot; algorithm, in which, for a set of points in a N-dimensional space (two-dimensional, in my case), two points are said to be &quot;friends&quot; if they are closer than a given linking length, and a friend of a friend also being a friend (i.e., if A is a friend of B and B of C, A is also a friend of C). Then, all the points that are friends among them are collected into a single cluster, leading to some final number of clusters. The motivation is that I typically have strongly clustered points, with different clusters far away from each other. I would like to allow for an arbitrary metric in the distance calculation (i.e., not necessarily the Euclidean metric).</p>
  <p>I could write this down from scratch, but I was wondering whether it can be easily implemented using existing libraries or some smart array-based Python.</p>