Kruskal Algorithm Maze Generation
The Randomized Kruskal Algorithm
This algorithm creates a new maze from a grid of cells. To begin, each cell belongs to its own set. Then:- Choose a random wall (vertical or horizontal) between two cells.
- If the cells on each side of that wall are already in the same set, do nothing.
- If the cells on each side of the wall are not in the same set:
- demolish the wall, and
- merge the sets containing those two cells.
- Continue choosing random walls until all cells are in the same set.
About the Applet
This applet was created using JavaScript and the P5 library. No other libraries/dependencies are required. If you are having trouble viewing the applet, be sure JavaScript is enabled in your browser. Click here for instructions. Internet Explorer is not recommended for this applet.This applet was last updated July 2019.