Is there any way I can make my maze solver algorithm better?

I am currently working on a pathfinding system, one using BFS and one using DFS, the problem with it is that I have to manually place, name parts, and define them as a graph in my code
Any suggestions automatically make parts automatically around the maze
Here’s the graph definition:

local graph = {}
graph["0"] = {"1"}
graph["1"] = {"2", "3"}
graph["2"] = {"5"}
graph["3"] = {"4"}
graph["4"] = {"6"}
graph["5"] = {"7","9"}
graph["6"] = {}
graph["7"] = {"8"}
graph["8"] = {}
graph["9"] = {"10"}
graph["10"] = {"11", "12"}
graph["11"] = {"13"}
graph["12"] = {}
graph["13"] = {"14"}
graph["14"] = {"15", "23"}
graph["15"] = {"16"}
graph["16"] = {"17"}
graph["17"] = {"18"}
graph["18"] = {"19", "21"}
graph["19"] = {"20"}
graph["20"] = {"21"}
graph["21"] = {}
graph["22"] = {}
graph["23"] = {"24"}
graph["24"] = {"25"}
graph["25"] = {"22", "27"}
graph["27"] = {"28"}
graph["28"] = {"29"}
graph["29"] = {"30", "34"}
graph["30"] = {"31"}
graph["31"] = {"32"}
graph["32"] = {"33"}
graph["33"] = {"35"}
graph["34"] = {}
graph["35"] = {}

video on how it works:
https://youtu.be/82KRYXPUtVE

1 Like

#help-and-feedback:code-review

Please upload your video to youtube, nobody wants to download it.

updated, do you know how to improve the algorithm