Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: (Golf) Shortest Graph Distance

by MeowChow (Vicar)
on May 12, 2001 at 01:42 UTC ( #79847=note: print w/replies, xml ) Need Help??


in reply to (Golf) Shortest Graph Distance

Best I could do so far, strict and warning clean, at 158 chars:
sub path { my($g,$s,$e,@p,$q)=@_;@_=[0,$s];{my($l,@r)=@{+shift};if(!@p||$q>$l){ +@p=@r,$q=$l if$r[-1]eq$e;my$o=$$g{$r[-1]};push@_,map[$l+$$o{$_},@r,$_ +],keys%$o}@_&&redo}@p }
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://79847]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2023-12-08 02:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (35 votes). Check out past polls.

    Notices?