Technology moves fast! ⚡ Don't get left behind.🚶 Subscribe to our mailing list to keep up with latest and greatest in open source projects! 🏆


Subscribe to our mailing list

facebook-friend-rank

PHP class that can calculate who are the best user's friends. Data accuracy depends on the user activity and granted permissions.

Subscribe to updates I use facebook-friend-rank


Statistics on facebook-friend-rank

Number of watchers on Github 38
Number of open issues 1
Main language PHP
Open pull requests 0+
Closed pull requests 0+
Last commit over 6 years ago
Repo Created almost 7 years ago
Repo Last Updated over 1 year ago
Size 109 KB
Organization / Authorgajus
Contributors1
Page Updated
Do you use facebook-friend-rank? Leave a review!
View facebook-friend-rank activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating facebook-friend-rank for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Facebook Friend Rank Algorithm

ay-fb-friend-rank (demonstration) is a PHP 5.3 class that can calculate who are the best user's friends. Data accuracy depends on the user activity and granted permissions. The only dependancy is Facebook PHP SDK.

All the data is collected in two batched requests. Nonetheless, it takes time for Facebook to prepare this data (sometimes up to 5 seconds). Therefore, you are advised to cache the data once you have it and repeat the query only if user has approved more permissions.

Follow the blog entry about the Facebook Friend Rank Algorithm to find out about possible implementations.

Criteria

The following steps are taken to calculate the user ranking:

  1. The applications looks through user's feed entries. read_stream permission is required. However, if the latter is not given the app will rely on the public feed.

    • Profile is given feed_like score for liking user's feed .
    • Profile is given feed_comment score for leaving a comment on user's feed.
    • Profile is given feed_addressed score for addressing user in his feed, whether by posting directly on his wall or tagging the user in his post.
  2. Photos. user_photos and friends_photos permissions are required.

    • Profile is given photo_tagged_user_by_friend score if he tagged user in a photo.
    • Profile is given photo_tagged_friend_by_user score if user tagged him in a photo.
    • Profile is given photo_like score for liking a picture either uploaded by the user or a photo where user is tagged.
    • Profile is given photo_comment score for leaving a comment on a picture either uploaded by the user or a photo where user is tagged.
  3. Friends. No additional permissions required.

    • Profile is given friend_mutual score for every mutual friend.
  4. Inbox. read_mailbox is required.

    • Every profile is given inbox_in_conversation for participating in a mutual conversation with the user.
    • inbox_chat score is given for every message in a duologue.

Weights

By default every action is valued 1. Every criteria can be assigned an individual weight using setCriteriaWeight([action name, see $criteria], [numeric value]) method.

Roadmap

  • There are many more permissions that can improve the friend-rank accuracy that the script doesn't utilise yet, eg. user_hometown,friends_hometown,user_interests,friends_interests.
  • As per Jeff Widman's thoughts on the EdgeRank (http://edgerank.net/), this script dramatically lacks Time Decay criteria. This is the next thing on the to-do-list.

Alternatives

Facebook Developer Love

This class will become redundant once Facebook makes communication_rank column publicly available.

SELECT uid2, communication_rank FROM friend where uid1 = me() ORDER BY communication_rank DESC LIMIT 10;

Ruby

A similar attempt to calculate the friend index has been made by Mike Jarema using Ruby.

License & Notes

The BSD License - Copyright (c) 2012 Gajus Kuizinas.

facebook-friend-rank open issues Ask a question     (View All Issues)
  • over 5 years Project's future
facebook-friend-rank list of languages used
Other projects in PHP