Skip to content

Commit 2ae9d3f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9cd8ae4 commit 2ae9d3f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dynamic_programming/floyd_warshall.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, n=0): # a graph with Node 0,1,...,N-1
1313

1414
def add_edge(self, u, v, w):
1515
"""
16-
Adds a directed edge from node u
16+
Adds a directed edge from node u
1717
to node v with weight w.
1818
1919
>>> g = Graph(3)
@@ -25,7 +25,7 @@ def add_edge(self, u, v, w):
2525

2626
def floyd_warshall(self):
2727
"""
28-
Computes the shortest paths between all pairs of
28+
Computes the shortest paths between all pairs of
2929
nodes using the Floyd-Warshall algorithm.
3030
3131
>>> g = Graph(3)
@@ -60,6 +60,7 @@ def show_min(self, u, v):
6060

6161
if __name__ == "__main__":
6262
import doctest
63+
6364
doctest.testmod()
6465

6566
# Example usage
@@ -76,5 +77,9 @@ def show_min(self, u, v):
7677
graph.add_edge(4, 2, 4)
7778
graph.add_edge(4, 3, 9)
7879
graph.floyd_warshall()
79-
print(graph.show_min(1, 4)) # Should output the minimum distance from node 1 to node 4
80-
print(graph.show_min(0, 3)) # Should output the minimum distance from node 0 to node 3
80+
print(
81+
graph.show_min(1, 4)
82+
) # Should output the minimum distance from node 1 to node 4
83+
print(
84+
graph.show_min(0, 3)
85+
) # Should output the minimum distance from node 0 to node 3

0 commit comments

Comments
 (0)