porkpilot has asked for the wisdom of the Perl Monks concerning the following question:
Please hear me for I am in much need of your wisdom...
Nearing the anniversary of this (Golf) post, I find myself faced with a similar, "bacon number" type problem.
I have a MySQL database of collected factoids (nodes), each identified by a unique integer. Intersecting factoids (vertices) are identified in graph coordinate fashion. So, if fact1id='1' and fact2id='2', the intersection between them is identified as (1,2).
After hours of searching the web, a good deal of thought and much fiddling with code, I am left wondering about a few things... (Please read more for questions.)
Firstly, since the data is not recorded in the database in similar form to the Bacon/Golf post mentioned above, I am wondering if the form
%t =(22 =>[7, 40, 19, 24, 21, 33], ... 40 =>[18, 33, 23, 37, 22, 48, 26, 45], ... 23 =>[25, 46, 27, 40], ... 27 =>[46, 2, 28, 16, 23, 47] ... );
Secondly, though I am quite sure the Perl golf examples are well done, I have a hard time following them let alone coaxing out the results I would hope to get. Does anyone have or know where I can find a more fleshed out example of a shortest path/breadth first search (with "bacon number" tracking, perferably) in Perl? The samples I have been looking at are in C or Java--I don't know Java and it's been years and years since I looked at C.
Lastly, and this is the tie-in for all of the above, how would an experienced Perl programmer approach the problem?
Thanks very much in advance for any help!
Edit by tye, adjust links
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Graph traversal--shortest path?
by djantzen (Priest) on May 04, 2003 at 23:49 UTC | |
|
Re: Graph traversal--shortest path?
by Abigail-II (Bishop) on May 04, 2003 at 23:17 UTC | |
|
Re: Graph traversal--shortest path?
by ferrency (Deacon) on May 05, 2003 at 14:48 UTC | |
|
Re: Graph traversal--shortest path?
by jkahn (Friar) on May 05, 2003 at 19:41 UTC | |
by Anonymous Monk on May 06, 2003 at 04:31 UTC | |
by porkpilot (Deacon) on May 06, 2003 at 11:59 UTC |