I want to find my friend whom I share with them the highest number of mutual friends.
I tried to do it with FQL and graph API the following way:
Get the friends list of the current logged in user.
FQL:SELECT uid1 FROM friend WHERE uid2="MY_USER_ID" and uid1 IN (SELECT uid1 FROM friend WHERE uid2=me())
Graph API:$facebook->api('/me/friends?format=json&limit=5000')
For each one of the uid's in the list, I can get the list of mutual friends and count it.
FQL:SELECT uid1 FROM friend WHERE uid2="OTHER_USER" and uid1 IN (SELECT uid1 FROM friend WHERE uid2=me())
Graph API:$facebook->api('me/mutualfriends/OTHER_USER')
HOWEVER, it takes TONS of time to run this through all my friends...
Are you familiar with a better way to do that?