File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
import heapq
2
2
import sys
3
3
4
- #First implementation of johnson algorithm
5
- #Steps followed to implement this algorithm is given in the below link:
6
- #https://brilliant.org/wiki/johnsons-algorithm/
4
+
5
+ # First implementation of johnson algorithm
6
+ # Steps followed to implement this algorithm is given in the below link:
7
+ # https://brilliant.org/wiki/johnsons-algorithm/
7
8
class JohnsonGraph :
8
9
def __init__ (self ) -> None :
9
10
self .edges = []
@@ -46,8 +47,8 @@ def bellman_ford(self, s) -> dict:
46
47
distances [v ] = distances [u ] + w
47
48
48
49
return distances
49
-
50
- #perform the johnson algorithm to handle the negative weights that
50
+
51
+ # perform the johnson algorithm to handle the negative weights that
51
52
# could not be handled by either the dijkstra
52
53
#or the bellman ford algorithm efficiently
53
54
def johnson_algo (self ) -> dict :
You can’t perform that action at this time.
0 commit comments