I’m thinking of an application that would try to prove the ‘Six degrees of separation‘ theory with a set of users that are part of a social network.
I would have those elements:
- A couple of users for which I’d like to prove the six degrees theory
- For each user, I know the list of friends in the social network
Which is the best algorithm to see if the two users are connected, with which degree and show the eventual steps in the connection?
Finding the degree of separation between two people in a social network is just a special case of finding the shortest path between two points in a graph. The most common approach is Dijkstra’s algorithm, but see also a longer discussion of the Shortest path problem.
In addition, by running an All-pairs shortest path algorithm, you could find out the minimum, maximum, and average number of degrees of separation for the entire network.