自分の理解のため Python でグラフ構造を探索する手法の DFS(深さ優先探索)、BFS(幅優先探索)を実装してみた。 上図のような構造のグラフを探索する。 DFS(深さ優先探索) DFS では根(ここではノード1)から探索を開始して、次の枝(ここではノード5 ...
深さ優先探索で集合S= [1, 2, 3, 4, 61, 8, 9, 11, 121, 13, 14]の中の最大値を求める。
# Load the maze from the csv file. You may need to change this path depending on where you save the files. m.LoadMaze(loadMaze=r"C:\Users\ZA Traders\Downloads ...
# https://www.lanqiao.cn/problems/149/learning/?page=1&first_category_id=1&tags=BFS&tag_relation=intersection&difficulty=20 ...