in reply to Tree in perl
Such a shame that Graph is out of support.
use 5.16.2; use warnings; use Graph; my $g = Graph->new; while (<DATA>) { $g->add_edge (m/(\w+)/g); } say join "-" => $g->SP_Dijkstra (1, 5); __END__ 5 6 1 2 2 3 2 4 4 5 1 3 3 5 -> 1-3-5
|
|---|