Answer the question
In order to leave comments, you need to log in
What is the best way to solve this problem?
Good afternoon,
there is a task - to find the shortest path between 2 users through their friends (no more than 5 elements in the chain, including friends).
There is a table with fields `id`, `user_id`, `friend_id`, where `friend_id` are Facebook friends of the user who are also registered in the service.
The question is what is better to use here - some algorithm from graph theory or maybe something else?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question