Skip to content

Commit a00d41c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9a4e1d3 commit a00d41c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graphs/johnson_graph.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ def __init__(self) -> None:
1111
self.graph: dict[str, list] = {}
1212

1313
# add vertices for a graph
14-
def add_vertices(self, u:int) -> None:
14+
def add_vertices(self, u: int) -> None:
1515
self.graph[u] = []
1616

1717
# assign weights for each edges formed of the directed graph
18-
def add_edge(self, u:str, v:str, w:int) -> None:
18+
def add_edge(self, u: str, v: str, w: int) -> None:
1919
self.edges.append((u, v, w))
2020
self.graph[u].append((v, w))
2121

2222
# perform a dijkstra algorithm on a directed graph
23-
def dijkstra(self, s:str) -> dict:
23+
def dijkstra(self, s: str) -> dict:
2424
distances = {vertex: sys.maxsize - 1 for vertex in self.graph}
2525
pq = [(0, s)]
2626
distances[s] = 0
@@ -37,7 +37,7 @@ def dijkstra(self, s:str) -> dict:
3737
return distances
3838

3939
# carry out the bellman ford algorithm for a node and estimate its distance vector
40-
def bellman_ford(self, s:str) -> dict:
40+
def bellman_ford(self, s: str) -> dict:
4141
distances = {vertex: sys.maxsize - 1 for vertex in self.graph}
4242
distances[s] = 0
4343

0 commit comments

Comments
 (0)