P
P
Pavel Novikov2018-10-31 16:30:56
Counts
Pavel Novikov, 2018-10-31 16:30:56

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

1 answer(s)
D
Dimonchik, 2018-10-31
@dimonchik2013

graph base

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question