Search for a minimal path in the maze.