Skip to content
Snippets Groups Projects
Verified Commit c029ff6f authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

:sparkles: add main to use dikjstra

parent 2bc18452
No related branches found
No related tags found
No related merge requests found
from graph.maze import Maze
from graph.graph_3 import Node, Edge, UnDirectedGraph
from graph.traversing import Dikjstra
labyrinthe = Maze(10, 10)
#labyrinthe.fill_random()
graph = UnDirectedGraph()
max = labyrinthe.nb_rows * labyrinthe.nb_cols
for row in range(labyrinthe.nb_rows):
for col in range(labyrinthe.nb_cols):
cell = labyrinthe.maze[col][row]
if cell == '.':
graph.add_edge(Node(), Node(), rank=max)
start = graph.get_node_by_id(0)
target = graph.get_node_by_id(12)
paths = Dikjstra(graph, start, target)
print(paths)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment