# perl-Algorithm-Graphs-TransitiveClosure

**Calculate the transitive closure**

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 == $j' or there is a path in _G_ from '$i' to '$j', and '$graph -> [$i] -> [$j] == 0' otherwise. * floyd_warshall HASHREF The graph _G = (V, E)_, with labeled vertices, is described with a hash of hashes, '$graph', representing _V x V_. If there is an edge between vertices '$label1' and '$label2' (or if '$label1 eq $label2'), then '$graph -> {$label1} -> {$label2} == 1'. For all other pairs '($label3, $label4)' from _V x V_, '$graph -> {$label3} -> {$label4}' does not exist. The resulting '$graph' will have '$graph -> {$label1} -> {$label2} == 1' iff '$label1 eq $label2' or there is a path in _G_ from '$label1' to '$label2', and '$graph -> {$label1} -> {$label2}' does not exist otherwise.

There is no official package available for openSUSE Leap 15.4### Distributions

#### openSUSE Tumbleweed