in reply to Graphs and Shortest Distance Between Nodes
To understand what is going on under the hood, look at the chapter on graphs in the book "Mastering Algorithms in Perl" published by O'Reilly.
-Mark