Algorithm-Graphs-TransitiveClosure

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        print "There is a path from three to one.\n" if
            $graph2 -> {three} -> {one};

DESCRIPTION
    This is an implementation of the well known *Floyd-Warshall* algorithm.
    [1,2]

    The subroutine "floyd_warshall" takes a directed graph, and calculates
    its transitive closure, which will be returned. The given graph is
    actually modified, so be sure to pass a copy of the graph to the routine
    if you need to keep the original graph.

    The subroutine takes graphs in one of the two following formats:

    floyd_warshall ARRAYREF
        The graph *G = (V, E)* is described with a list of lists, $graph,
        representing *V x V*. If there is an edge between vertices $i and $j
        (or if "$i == $j"), then "$graph -> [$i] -> [$j] == 1". For all
        other pairs "($k, $l)" from *V x V*, "$graph -> [$k] -> [$l] == 0".

        The resulting $graph will have "$graph -> [$i] -> [$j] == 1" iff "$i

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

    print "There is a path from three to one.\n" if
        $graph2 -> {three} -> {one};

=head1 DESCRIPTION

This is an implementation of the well known I<Floyd-Warshall> algorithm. [1,2]

The subroutine C<floyd_warshall> takes a directed graph, and calculates
its transitive closure, which will be returned. The given graph is
actually modified, so be sure to pass a copy of the graph to the routine
if you need to keep the original graph.

The subroutine takes graphs in one of the two following formats:

=over

=item floyd_warshall ARRAYREF

The graph I<G = (V, E)> is described with a list of lists, C<$graph>,
representing I<V x V>. If there is an edge between vertices C<$i> and
C<$j> (or if C<$i == $j>), then C<$graph -E<gt> [$i] -E<gt> [$j] == 1>. For all



( run in 0.227 second using v1.01-cache-2.11-cpan-1c8d708658b )