Breadth-First and Depth-First Search


Suppose you need to find your way out of the following maze, starting from where the bird is. How can you connect your knowledge of graphs to the maze problem? What are the nodes? What are the edges? Furthermore, how would you use graphs to answer the following questions:

  1. how would you find a path out of the maze?
  2. how would you find the shortest path out of the maze?
  3. how would you ensure you visit all locations in the maze?
  4. how would you build a maze in the first place?

Try using the arrow keys below to navigate through the maze and, ultimately, escape. If you reach the outlet, the bird will be frozen, so you can click on the "new maze" button to play again. The number of squares in each direction can be controlled by the spinbox number input. Please leave the mode "free" for now - you will use "DFS" mode for today's exit ticket.