Skip to content

Commit 2584473

Browse files
committed
Handled word length
1 parent 3d4acaa commit 2584473

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎graphs/johnson_graph.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,11 @@ def johnson_algo(self) -> list[dict]:
117117
>>> g = JohnsonGraph()
118118
>>> g.add_vertices("A")
119119
>>> g.add_vertices("B")
120-
>>> g.add_vertices("C")
121120
>>> g.add_edge("A", "B", 1)
122-
>>> g.add_edge("B", "C", 2)
123-
>>> g.add_edge("A", "C", 4)
121+
>>> g.add_edge("B", "A", 2)
124122
>>> optimal_paths = g.johnson_algo()
125123
>>> optimal_paths
126-
[{'A': 0, 'B': 1, 'C': 3}, {'A': None, 'B': 0, 'C': 2}, {'A': None, 'B': None, 'C': 0}]
124+
[{'A': 0, 'B': 1}, {'A': 2, 'B': 0}]
127125
"""
128126
self.add_vertices("#")
129127
for vertex in self.graph:

0 commit comments

Comments
 (0)