I know you can't get friends of friends, but can you get mutual friends using some query, in a computationally efficient manner?
Could I even iterate through my friends to see which of them is friends with a target? Is there any good way to get Mutual friends?
This might be old, i needed to calculate mutual friends between user X and me and found that @Sabari answer useful, except it had a mistake (unnecessary inner query)
This inner query will give one result ( 13245 ) as the friend table has two columns (both compose the primary key of the table) and the where clause is putting a condition on both columns.
so the whole query after removing this inner query should be:
This query calculates a list of all '13245' friends (
where uid1='13245'
) who are also my friends (the inner query)here is my code to get the list of mutual friends in python
You can do it like this:
This will return the id of the mutual friends. Hope this helps you :)
EDIT:
If you want to get the mutual friends between you and id=13245 then you can do like:
It will return all mutual friends id.
Hope this gives you what you want.
I had same problem. Though it is very late for answering question, it will help somebody. That's why answering this question.
Try this fql query:
By this we can get mutual friends info.