[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-10-25 16:01:29 +00:00
parent da0717b9ae
commit 18319a8733

View File

@ -2,6 +2,7 @@ from collections import deque
import heapq
import sys
# First implementation of johnson algorithm
class JohnsonGraph:
def __init__(self):
@ -52,7 +53,6 @@ class JohnsonGraph:
# 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):
self.add_vertices("#")
for v in self.graph:
if v != "#":
@ -79,6 +79,7 @@ class JohnsonGraph:
distances.append(new_dist)
return distances
g = JohnsonGraph()
# this a complete connected graph
g.add_vertices("A")