Algorithm-Graphs-TransitiveClosure-Tiny

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Algorithm-Graphs-TransitiveClosure-Tiny

1.03    2023/05/05
        POD: minor fix.

1.02    2023/05/03
        Added LICENSE file
        POD, README: Removed link to cpanratings.perl.org

1.01    2022/04/08
        Minor improvement of the POD section

1.00    2022/01/16
        - The second argument is now optional and has a different meaning.
        - Empty subhashes are removed by default.
        - The keys (vertices) no longer have to be integers, any strings can be used.
        - Adapted POD.

0.03    2022/01/14
        Added test, corrected typos in POD.

0.02    2022/01/14
        Improved POD.

lib/Algorithm/Graphs/TransitiveClosure/Tiny.pm  view on Meta::CPAN

                 that => {}
                };
    floyd_warshall($graph);

will result in

   {
    this => {that => undef}
   }

This behavior can be changed by setting optional second argument of
C<floyd_warshall> to a true value, i.e., calling C<floyd_warshall($graph, 1)>
with the above example hash will not remove C<that =E<gt> {}>.


=back

For convenience, C<floyd_warshall> returns C<$graph>.

For further information refer to L<Algorithm::Graphs::TransitiveClosure>.

t/01-floyd_warshall.t  view on Meta::CPAN

     exists($graph -> {2} -> {2}) &&
     exists($graph -> {2} -> {3}) &&
     4 == keys %{$graph -> {3}}   && exists($graph -> {3}  -> {0}) &&
     exists($graph -> {3}  -> {1}) &&
     exists($graph -> {3}  -> {2}) &&
     exists($graph -> {3}  -> {3}),
     "check result of floyd_warshall()");

  my $clone = dclone($graph);
  floyd_warshall($clone);
  is_deeply($clone, $graph, "calling floyd_warshall a second time won't change anything");
}


{
  note("Empty input");
  my $g = {};
  floyd_warshall($g);
  is_deeply($g, {}, "empty result");
}



( run in 0.591 second using v1.01-cache-2.11-cpan-39bf76dae61 )