graph: Adjust calculation to match exercise

This commit is contained in:
Marco Thomas
2022-07-27 14:32:37 +02:00
parent 0b29bdab3d
commit d6a8689175
6 changed files with 183 additions and 90 deletions

19
dijsktra.py Normal file
View File

@@ -0,0 +1,19 @@
"""
This module holds the logic for the solving
"""
class Dijkstra():
def __init__(self, graph: dict):
"""
table: matrix with vertex as key, price and prev vertex as value
OL: open list, to keep track of finished vertecis
"""
self.graph = graph
self.table = {}
self.OL = []
def algorithm(self):
print("Performing Dijkstra on the following graph...")
for vertex in self.graph:
print(f"{vertex}: {self.graph[vertex]}")