Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1beb5a5

Browse files
authored
Fixed wording of a sentence (#1551)
Previously it was valid for undirected graphs. Now it encompasses directed graphs as well.
1 parent 5b32a92 commit 1beb5a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/graph/all-pair-shortest-path-floyd-warshall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ However it is possible to improve the Floyd-Warshall algorithm, so that it caref
132132

133133
This can be done in the following way:
134134
let us run the usual Floyd-Warshall algorithm for a given graph.
135-
Then a shortest path between vertices $i$ and $j$ does not exist, if and only if, there is a vertex $t$ that is reachable from $i$ and also from $j$, for which $d[t][t] < 0$.
135+
Then a shortest path between vertices $i$ and $j$ does not exist, if and only if, there is a vertex $t$ such that, $t$ is reachable from $i$ and $j$ is reachable from $t$, for which $d[t][t] < 0$.
136136

137137
In addition, when using the Floyd-Warshall algorithm for graphs with negative cycles, we should keep in mind that situations may arise in which distances can get exponentially fast into the negative.
138138
Therefore integer overflow must be handled by limiting the minimal distance by some value (e.g. $-\text{INF}$).

0 commit comments

Comments
 (0)