Skip to content

Commit 3d4acaa

Browse files
committed
Added doctests
2 parents 5fe9e9b + 39fdc02 commit 3d4acaa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

graphs/johnson_graph.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ def johnson_algo(self) -> list[dict]:
139139
vertex_b,
140140
weight + hash_path[vertex_a] - hash_path[vertex_b],
141141
)
142-
self.edges[i] = (vertex_a,
143-
vertex_b,
144-
weight + hash_path[vertex_a] - hash_path[vertex_b])
142+
self.edges[i] = (
143+
vertex_a,
144+
vertex_b,
145+
weight + hash_path[vertex_a] - hash_path[vertex_b],
146+
)
145147

146148
self.graph.pop("#")
147149
filtered_edges = []
@@ -154,7 +156,7 @@ def johnson_algo(self) -> list[dict]:
154156
for vertex1, vertex2, node_weight in self.edges:
155157
if vertex1 == vertex:
156158
self.graph[vertex].append((vertex2, node_weight))
157-
159+
158160
distances = []
159161
for vertex1 in self.graph:
160162
new_dist = self.dijkstra(vertex1)

0 commit comments

Comments
 (0)