How does Facebook calculate mutual friends?

by rodi   Last Updated September 14, 2017 19:05 PM

How does Facebook calculate mutual friends?

Does it cache all mutual friends for each user? Does it use MySQL to calculate mutual friends with a query?

Answers 1

According to Facebook,

Mutual friends are the people who are Facebook friends with both you and the person whose profile you are viewing. For instance, if you are friends with Chris, and Mark is friends with Chris, then Chris will be shown as a mutual friend when you are viewing Mark's profile.

So, the set of mutual friends is the intersection of the set of your friends and the set of friends of the person you are viewing. If we assume that Facebook maintains an active cache of your friends, then when you view a person's page, another list containing that person's friends is retrieved, and the intersection of these two lists is the list of mutual friends.

Jay Elston
Jay Elston
June 15, 2011 00:00 AM

Related Questions

Am I planning my database/backend correctly?

Updated April 08, 2015 18:02 PM

foreign key with null value in MySQL

Updated January 22, 2018 19:05 PM

How to Define Service Area – with Zip Codes?

Updated November 01, 2017 15:05 PM

design bd for inventory management

Updated November 01, 2017 16:05 PM

I couldn't think of any db architecture for this

Updated October 13, 2018 12:05 PM