File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -743,8 +743,9 @@ class Graph
743743 die ' The first argument is expected to be an integer or Whatever.'
744744 unless $ max-distance . isa (Whatever ) || $ max-distance ~~ Int : D ;
745745
746- if $ method . isa (Whatever ) { $ method = ' floyd-warshal' }
747- return do if $ method . lc ∈ <floyd-warshal floydwarshall > {
746+ if $ method . isa (Whatever ) { $ method = ' floyd-warshall' }
747+
748+ return do if $ method . lc ∈ <floyd-warshall floydwarshall > {
748749 my % res = self ! floyd-warshall();
749750 my @ mat = | % res <dist >;
750751 if $ pairs {
@@ -761,11 +762,11 @@ class Graph
761762 }
762763 } elsif $ method . lc ∈ <dijkstra unit-weight unitweight > {
763764 if $ pairs {
764- my % ds = self . vertex-list. map ({ $ _ => self . distance($ _ , : pairs) });
765+ my % ds = self . vertex-list. map ({ $ _ => self . distance($ _ , : $ method , : pairs) });
765766 my % res = % ds . kv . map (-> $ k , % v { % v . map ({ ($ k , $ _ . key ) => $ _ . value }) }). flat ;
766767 $ max-distance . isa (Whatever ) ?? % res !! % res . map ({ $ _ . key => $ _ . value > $ max-distance ?? Inf !! $ _ . value }). Hash
767768 } else {
768- my @ res = self . vertex-list. map ({ self . distance($ _ , :! pairs ) });
769+ my @ res = self . vertex-list. map ({ self . distance($ _ , : $ method , : !pairs ) });
769770 $ max-distance . isa (Whatever ) ?? @ res !! @ res . deepmap({ $ _ > $ max-distance ?? Inf !! $ _ })». List . List
770771 }
771772 }
You can’t perform that action at this time.
0 commit comments