<?xml version="1.0" encoding="windows-1252"?>
<node id="79830" title="Re: (Golf) Shortest Graph Distance" created="2001-05-11 20:03:24" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="78006">
no_slogan</author>
<data>
<field name="doctext">
My first try.  Passes -w and strict.  172 characters.
&lt;code&gt;sub path {
my($g,$a,$b,$x,$y,%s)=@_;$s{$a}=[0,[$a]];for(%$g){for(keys%s){$s{$x}&amp;&amp;$s{$_}[0]+$y&gt;$s{$x}[0]or$s{$x}=[$s{$_}[0]+$y,[@{$s{$_}[1]},$x]]while($x,$y)=each%{$g-&gt;{$_}}}}$s{$b}[1]
}&lt;/code&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt;Oops, it returns an arrayref instead of
an array.  No point in fixing it, [chipmunk]'s solution
puts mine to shame anyway.</field>
<field name="root_node">
79811</field>
<field name="parent_node">
79811</field>
</data>
</node>
