in reply to sql adjacency list
If
The major improvement that this has over a SQL solution is that it will scale better the more friendships you have. If you have, say, 50 people in your database and each is friends with 20 people, you have 50 vertices and 1000 edges. If each person meets 5 people, you still have 50 people, but 1250 edges. If done poorly, the friendship table in Aristotle's solution will bog you down.
I also have a version of Graph::Undirected* that is optimized for this type of analysis (unique edges between vertices) which is up to 4x faster than the generic Graph::Undirected on CPAN.
*: Jarrko's aware of it.
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
|
|---|