diff --git a/Graph/labirynth.py b/Graph/labirynth.py new file mode 100644 index 0000000000000000000000000000000000000000..89a0576bc94ab3fe9313812b342a6fddcfeb273f --- /dev/null +++ b/Graph/labirynth.py @@ -0,0 +1,21 @@ +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