Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
We don't bite newbies here... much
 
PerlMonks  

Re: (Golf) Shortest Graph Distance

by chipmunk (Parson)
on May 12, 2001 at 00:15 UTC ( #79834=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub path {
    (*g,$f,$t)=@_;@s=map[$f,$_,$r{$_}],keys%{*r=$g{$f}};
    push@s,map[@p,$_,$d+$r{$_}],keys%{*r=$g{$n}}
    while(@s=sort{$b->[-1]<=>$a->[-1]}@s),$d=pop@{*p=pop@s},
    ($n=$p[-1])ne$t;@p
    }
    
  2. or download this
    sub path {
    (*g,$f,$t)=@_;@s=[$f,0];
    push@s,map[@p,$_,$d+$r{$_}],keys%{*r=$g{$n}}
    while(@s=sort{$b->[-1]<=>$a->[-1]}@s),$d=pop@{*p=pop@s},
    ($n=$p[-1])ne$t;@p
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-04-19 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (480 votes), past polls