Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Depth-first Search (DFS)

Introduction

A depth-first search (DFS) algorithm explores graph or tree structures by traversing down one branch as far as possible before backtracking. This strategy entails managing the frontier, which is the set of nodes that are yet to be explored. In DFS, the frontier is typically handled using a stack data structure, adhering to the "last-in, first-out" (LIFO) principle.

Usage

python maze.py maze.txt

Examples

Maze 1

img

Solution 1

img

States Explored: 17

img

Maze 2

img

Solution 2

img

States Explored: 194

img

Maze 3

img

Solution 3

img

States Explored: 483

img

References