Welcome to the Monastery  
PerlMonks 
comment on 
( #3333=superdoc: print w/replies, xml )  Need Help?? 
Given: A graph %g composed of a hash of hashes; the keys of %g are the names of the nodes of the graph, and the value of each is another hash (temporarily, call it %t); the keys of %t are other nodes in the graph that can be accessed by the current node, and the values are the distances to those nodes. So, in the case where, say "Chicago" and "Cleveland" are separated by a distance of 400, %g will look like:
All distances are nonzero, positive values. The graph is not necessarily bidirectional (That is, if the distance from 'A' to 'B' is 1, the distance from 'B' to 'A' may not necessarily be 1, nor may it be possible to go from B to A directly.) There are no disjoint parts of the graph or dead ends, so that it is possible to go to any other point from a given point. Also, you are given two node names, $a and $b. Find a perl golf solution that returns an array of the node names in the shortest distance route from $a to $b, including $a and $b. UPDATE as suggested by MeowChow to set the order of the sub parameters as \%g, $a, $b. More Updating Goodness: Here's a test case for ya :) Update: yea, fixed the stupid parens here.... Dr. Michael K. Neylon  mneylonpm@masemware.com  "You've left the lens cap of your mind on again, Pinky"  The Brain In reply to (Golf) Shortest Graph Distance by Masem

