mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
Added method return type and resolved merge conflics
This commit is contained in:
commit
5a87d4fe9e
|
@ -1,9 +1,10 @@
|
|||
import heapq
|
||||
import sys
|
||||
|
||||
#First implementation of johnson algorithm
|
||||
#Steps followed to implement this algorithm is given in the below link:
|
||||
#https://brilliant.org/wiki/johnsons-algorithm/
|
||||
|
||||
# First implementation of johnson algorithm
|
||||
# Steps followed to implement this algorithm is given in the below link:
|
||||
# https://brilliant.org/wiki/johnsons-algorithm/
|
||||
class JohnsonGraph:
|
||||
def __init__(self) -> None:
|
||||
self.edges = []
|
||||
|
@ -46,8 +47,8 @@ class JohnsonGraph:
|
|||
distances[v] = distances[u] + w
|
||||
|
||||
return distances
|
||||
|
||||
#perform the johnson algorithm to handle the negative weights that
|
||||
|
||||
# perform the johnson algorithm to handle the negative weights that
|
||||
# could not be handled by either the dijkstra
|
||||
#or the bellman ford algorithm efficiently
|
||||
def johnson_algo(self) -> dict:
|
||||
|
|
Loading…
Reference in New Issue
Block a user