Is it possible to write a MySQL query to find a chain of friends? on a relational database?
using one of the algorithms
Floyd-Warshall algorithm
Dijkstra's algorithm
Bidirectional search. D
so here's the problem
there's a table with roughly this structure
ID IDUSER1 IDUSER2
if such a connection exists, then they are friends
need to get the shortest chain of friends between two people (if one exists), with output of all intermediate friends
Comments