boulevard has asked for the wisdom of the Perl Monks concerning the following question:
Hi, The following table is from a database:
Col1 Col2 Al Ibrahim Al Bob Al Chuck Al Frank Bob Gary Bob Doug Chuck Doug Chuck Ed Chuck Frank Doug Hamza Gary Ibrahim Gary Hamza This is the above representation of all connections/links/friendship o +f each friend: Al--------Frank /|\ | / | \ | / | \ | / | \ | / | \ | Ibrahim Bob Chuck \ /| / | \ / | / | \ / | / | Gary Doug Ed \ / \ / \ / Hamza
I use SELECT (through recursion) to figure out a friend's friends and their friends, it works fine. I am wondering if there is a way (without using recursion-as it causes too much overhead) to be able to figure out who are, say, "AL" 's friends and inturn their friends. In other words, I need to determine how to find a friend's all the friends and their friends(friend of a friend of a friend and so on) without using recursion. I also did some search on sql and "adjacency list" but didn't find much helpful.
Any help is highly appreciated. Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sql adjacency list
by perl_lover (Chaplain) on Feb 19, 2005 at 10:09 UTC | |
by Anonymous Monk on May 18, 2012 at 11:27 UTC | |
by marto (Cardinal) on May 18, 2012 at 11:32 UTC | |
by erix (Prior) on May 18, 2012 at 18:05 UTC | |
|
Re: sql adjacency list
by dbwiz (Curate) on Feb 19, 2005 at 12:29 UTC | |
by Your Mother (Archbishop) on May 18, 2012 at 19:55 UTC | |
|
Re: sql adjacency list
by Aristotle (Chancellor) on Feb 19, 2005 at 14:05 UTC | |
|
Re: sql adjacency list
by dimar (Curate) on Feb 19, 2005 at 14:09 UTC | |
|
Re: sql adjacency list
by jdalbec (Deacon) on Feb 19, 2005 at 15:39 UTC | |
|
Re: sql adjacency list
by dragonchild (Archbishop) on Feb 19, 2005 at 22:37 UTC | |
|
Re: sql adjacency list
by TedPride (Priest) on Feb 19, 2005 at 10:37 UTC |