Friend of friend search

db , mysql Ambāla, India
  • 12 years ago

    Hi All,

    I need to implement "Friend of a Friend" problem with minimal costs using either MySQL or PHP/MySQL. I wonder if there is an implementation that would just allow to solve this problem with minimal costs The description is as below:-

    I want to build a "social network" extension and try to find the best way to implement a Friend of a Friend connection path. (Facebook has something like that I think) e.g. We both have the same friend, but don't know each other. The algorithm should give me a path from me, over our same friend to you. (Me - Friend - You) But it should also find connections, that have a bigger distance, e.g. (Me - Friend1 - Friend2 - Friend3 - You) but not exceeding this situation - (Me - Friend1 - Friend2 - Friend3 - Friend4 - You)

    I stored user relations in database as I (user_id|friend_id = me|friend and friend|me) Any help would be really grateful

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens