Skip to content

Solves maze images with 1 px wide corridors using graphs. Algroithm is custom designed by me.

Notifications You must be signed in to change notification settings

zakupower/Maze-Solver

Repository files navigation

Rules for the maze

  • 1 px wide corridors
  • entrance should be at top of image 1 px
  • exit should be at bottom of image 1 px
  • only 1 exit only 1 entrance
  • RGB Image - this could be easily changed to greyscale but I prefer to stay with it for now

Result image is generated by the program with blue path.

DFS and BFS

The solver uses undirected non-weighted graph for the DFS and BFS solving of the maze
alt tag - DFS
93x93
alt tag - BFS
93x93

Shortest Route

For the shortest route it converts the graph to a vertices weighted undriected graph - very fast And finds the shortest route on an algorithm that looks for the highest weighted neighbour vertex.
alt tag
179x179
alt tag
400x400
DFS and BFS start to get really memory heavy after maze 200x200 but the Shortest root remains really fast The slowest part of the program is when the image is converted into a undirected graph.

Algorithms illustrated

Maze Image to Nodes -> Nodes to Graph -> Graph to Weighted Graph -> Shortest root algorithm
alt tag

Web mazes

Mazes i have found on the web and edited just so they can fit my rules of a maze
alt tag
601x151 - 103831 ms - 1.73 min
alt tag
512x384 - 123047 ms - 2.05 min
alt tag
515x488 - 14.09 min
alt tag
700x700 - 66.3 min
alt tag
Wikipedia Maze Solving - 1802x1802 - ~24 hours(first build) / 1.02 minutes (loaded from serialization -> only the shortest path algorithm)

About

Solves maze images with 1 px wide corridors using graphs. Algroithm is custom designed by me.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published