# Approach to cluster facebook users

I want to cluster Facebook user based on the number of mutual friends. If two users have more number of mutual friends then they are designated more closer to each other. I am thinking about using k-medoids clustering algorithm. In R I can use PAM for k-medoid clustering which needs data as a distance matrix.But How can I have mutual friend as similarity criteria? How can I convert this similarity to a distance matrix?

You could use any distance measure that decreases as the number of mutual friends increases. For example, \begin{equation} D = \frac{1}{m} \end{equation}where $m$ is the number of mutual friends. As $m$ increases, your distance decreases, which is what you want. Another possible measure is \begin{equation} D = e^{-m}. \end{equation} I had a spatial stats project a few years ago where I had to do something similar. I noticed that the exact distance measure didn't have much impact on the results. You can try a bunch of different distance measures and see.