mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-27 08:56:44 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
da0717b9ae
commit
18319a8733
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user