NAME
Algorithm::Graphs::TransitiveClosure::Tiny - Calculate the transitive closure.
SYNOPSIS
use Algorithm::Graphs::TransitiveClosure::Tiny qw(floyd_warshall);
my $graph = {
0 => {0 => undef},
1 => {1 => undef, 2 => undef, 3 => undef},
2 => {1 => undef, 2 => undef},
3 => {0 => undef, 2 => undef, 3 => undef},
};
floyd_warshall $graph;
print "There is a path from 2 to 0.\n" if
exists($graph->{2}) && exists($graph->{2}->{0});
The latter can also be written shorter provided you accept autovivification:
print "There is a path from 2 to 0.\n" if exists($graph->{2}->{0});
DESCRIPTION
This is taken from Algorithm::Graphs::TransitiveClosure. The difference is that this implementation of floyd_warshall()
:
works on hashes only,
uses
undef
as hash value, so an incidence must be checked withexists()
,assumes that the hash keys are integers 1, ..., N (for some integer N) and this N must be passed as second argument. This is needed to fix a problem in the original implementation.
For further information refer to Algorithm::Graphs::TransitiveClosure.
AUTHOR
Abdul al Hazred, <451 at gmx.eu>
BUGS
Please report any bugs or feature requests to bug-algorithm-graphs-transitiveclosure-tiny at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-Graphs-TransitiveClosure-Tiny. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SEE ALSO
Algorithm::Graphs::TransitiveClosure, Text::Table::Read::RelationOn::Tiny
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Algorithm::Graphs::TransitiveClosure::Tiny
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Algorithm-Graphs-TransitiveClosure-Tiny
CPAN Ratings
https://cpanratings.perl.org/d/Algorithm-Graphs-TransitiveClosure-Tiny
Search CPAN
https://metacpan.org/release/Algorithm-Graphs-TransitiveClosure-Tiny
LICENSE AND COPYRIGHT
This software is copyright (c) 2022 by Abdul al Hazred.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.