Facebook Friend Suggestion Algorithm

Shreyash Movale
6 min readJul 16, 2022

The Facebook Friend Suggestion Algorithm is a system that suggests friends for you to add to Facebook. It can be personalized based on the people that you interact with most.

Facebook’s algorithm is designed to make it easier to find friends and connections. The algorithm is also designed so that when people are added, they will have more in common with the other members of the friend group.

Facebook’s friend suggestion algorithm is one of the most important algorithms. It is a machine learning algorithm that recommends friends to users and attempts to predict who they might want to add as friends. It has been updated numerous times over the years and has evolved with the passage of time. Facebook has been using this algorithm for over ten years, which means it has undergone numerous changes.

The algorithm’s first version was not very good; it only suggested friends based on people you knew and your contact list. The second version, released in 2011, added mutual friends’ to the equation. It began recommending people who have mutual friends with others.

The friend suggestion algorithm on Facebook is a complex system that uses a number of factors to determine which friends to show on your feed. One of the factors Facebook considers is how much time you spend looking at specific friends’ posts. This is known as “mutual liking.” Facebook also considers your interactions with specific people as well as what they post. The algorithm will then recommend people you might want to add as friends because they are similar to those in your network.

People, you may know?

The Friend Suggestion Algorithm on Facebook is an extension of the News Feed algorithm. It determines who your friends are and what posts you see. People will appear in your feed more frequently if you interact with them (comment, like, share). The algorithm has been tweaked and updated over time to make it more user-friendly. This includes the addition of a “People You May Know” section to assist people in making new friends.

Facebook employs collaborative and content-based filtering to recommend people you may know, display ads based on your posts, jobs you may be interested in, groups you may want to follow, or companies you may be interested in. Facebook has been working on ways to improve its algorithm so that it surfaces the best content to the people who are most likely to engage with it, resulting in fewer interruptions for users. The Facebook algorithm ensures that all Facebook users receive the most relevant updates, news, and information. Although it is not an easy algorithm to crack, some ranking factors are well known: inventory, signals, predictions, and relevancy score.

What is a recommender system?

Facebook or most e-commerce or similar apps uses the recommenders engine to give suggestions. Let’s see what is recommender system.

Recommender systems are information filtering systems that aid in the resolution of the problem of information overload by filtering and segregating information and creating fragments from large amounts of dynamically generated information based on the user’s preferences, interests, or observed behavior regarding a specific item or items. Based on the user’s profile and historical data, a recommender system can predict whether a specific user would prefer an item or not. There are two main types of recommendation engines; namely collaborative filtering and content-based filtering. Most of the recommender algorithm is a hybrid form of these two.

Collaborative & Content-Based filtering

The Collaborative filtering method for recommender systems is a method for producing new recommendations that are solely based on previous interactions between users and Facebook activity. Collaborative Filtering seeks out whose posts user likes in past and comments on the activities of other users and provides recommendations in order to classify users into clusters of similar types and recommend each user based on the preferences of its cluster. The central idea governing collaborative methods is that by processing past user-user interactions through the system, it becomes sufficient to detect similar users in order to make predictions based on these estimated facts and insights.

The content-based approach makes use of additional data about users and/or items. This filtering method recommends other friends’ suggestions based on the details submitted by the user while creating the account such as age, location, workplace, or educational institutions.

The k-nearest neighbours (KNN) algorithm

The k-nearest neighbours (KNN) algorithm is a data classification method that estimates the likelihood that a data point will belong to one of two groups based on which data points are closest to it.

The supervised machine learning algorithm k-nearest neighbour is used to solve classification and regression problems. However, it is primarily used to solve classification problems.

To put it simply, KNN uses a voting mechanism to determine the class of an unseen observation. This means that the class with the most votes will become the data point’s class.

If K is equal to one, we will only use the nearest neighbor to determine the class of a data point. If K is equal to ten, we will use the ten nearest neighbours, and so on.

K-Nearest Neighbor ideology

How does Facebook improve your suggestions?

Facebook says Feed “shows you stories that are meaningful and informative.” As of 2022, the Facebook algorithm figures out what those stories might be using three main ranking signals. Part of their work is to improve the algorithms that connect Facebook users with the most valuable content for them. It also determines the friend suggestions based on various factors. Some of them are:

  • Friends you add: When you add someone as a friend, you are telling Facebook who you want to add as a friend. As a result, Facebook will begin looking for similar profiles and people in common. Most likely, the suggestion would be changed to that of the users’ friends.
  • Friends of friends: Mutual friends are one of the most common ways that Facebook suggests. You may come across this and notice that you have more than 100 mutual friends with someone.
  • Bio: The way you fill out your bio affects who your next friends will be. Facebook would find and suggest people who are in the same category based on information from your schools, university, places you lived, and family members.
  • Likes and comments: The way you like posts influences the Facebook friend’s recommendation. For example, if you like a page about the automobile industry, people who share your interests will appear in your friend suggestion list.
  • The profile you visit: If you frequently visit a Facebook profile, Facebook will receive notification that you want to be friends with that person. As a result, they would be added to the suggestion list.
  • Facebook search bar: Every term you enter into the Facebook search bar can be interpreted as an indication of your needs. Facebook will receive this soon and send you a suggestion that may be of assistance to you. Other people may search your profile, and as a result, you may appear on our suggested friend’s list.
  • Google search: Because I have experience with this, this is an estimated factor of Facebook’s suggestion. I noticed that the type of profile that Facebook shows me is changing while I was searching for my favorite program and university on Google. I realized that those users had studied at the universities I had researched, or they had studied what I had researched.
  • Contacts on the phone: People who already have your phone number in their phonebook. As a result, anyone who has your phone number in their contacts will appear in the “People you may know” section of both your Facebook account and Messenger.


Facebook is constantly trying to gather more information about its users in order to build a more accurate network graph, which will lead to better services such as friend suggestions, event suggestions, and possibly even what appears in your top news feed. Facebook is working on improving its algorithm to promote more engaging content.


  1. https://blog.hootsuite.com/facebook-algorithm/
  2. https://analyticsindiamag.com/collaborative-filtering-vs-content-based-filtering-for-recommender-systems/
  3. https://learn.g2.com/k-nearest-neighbor
  4. https://www.technewstoday.com/facebook-suggest-friends/



Shreyash Movale

Hi, I’m a Data Science Enthusiast, an Automobile Engineer by profession, having an interest in Artificial intelligence and experience in Automobile Sectors.