We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57adc57 commit f057f1dCopy full SHA for f057f1d
matrix/transitive_closure.py
@@ -25,7 +25,7 @@ def transitiveClosure(graph):
25
n = len(graph)
26
ans = [[graph[i][j] for j in range(n)] for i in range(n)]
27
28
- # Transtive closure of (i, i) will always be 1
+ # Transtive closure of (i, i) will always be 1
29
for i in range(n):
30
ans[i][i] = 1
31
@@ -34,15 +34,15 @@ def transitiveClosure(graph):
34
for k in range(n):
35
36
for j in range(n):
37
-
38
- # Check if a path exists between i to k and
+ # Check if a path exists between i to k and
39
# between k to j.
40
if ans[i][k] == 1 and ans[k][j] == 1:
41
ans[i][j] = 1
42
43
return ans
44
+
45
if __name__ == "__main__":
46
import doctest
47
48
- doctest.testmod()
+ doctest.testmod()
0 commit comments