Depth First Search (DFS) in Python [Python Maze World- pyamaze]

preview_player
Показать описание
Python Maze World
In this series we will learn about different Maze Search Algorithm in Python e.g., Depth First Search (DFS), Breadth First Search (BFS), A-Star Search, Dijkstra's Algorithm and many other possible search and navigation algorithms like Wall Following Robot, Reinforcement Learning, Genetic Algorithm etc.

This video is about Depth First Search (DFS).

(00:00) Intro
(00:32) Graph, Maze and Tree
(02:48) DFS and BFS
(06:23) What is Stack
(07:36) Pseudocode of DFS
(12:07) DFS Implementation in Python

⭐⭐Breadth First Search (BFS) Implementation:

⭐⭐A-star (A*) Search Implementation:

⭐⭐Comparison of DFS, AFS and A*

⭐⭐Dijkstra's Algorithm:

You can download the package as:
pip install pyamaze

Or you can copy the module code from here:

The used demo file is here :

How to use pyamaze module:

What is __name__=='__main__':

Here is the Playlist:

#Python #pyamaze #Python
Рекомендации по теме
Комментарии
Автор

This was explained perfectly. The graphics and animations were really useful!

bitnewt
Автор

You can change the direction string ('nsew') in each iteration, depending on the position of the current cell in relation to the goal cell. This speeds up the algorithm on average, as it will attempt to move closer to the goal first at each step. Don't forget to reverse the order of the preferred directions for each case, as the last character will be added to the stack last, thus considered first for a new iteration.

Agnes_Noby_sir
Автор

Thank you so so much. You are a savior😭

aryanraskar
Автор

man this is the most usfull video explaining the algorithm thank you❤❤

abdallhelmasry
Автор

thanks a lot, I understood DFS by your video. Esselamu aleykum.

aczsair
Автор

Thank you this is really convenient and brain friendly explanation

malibaturhan
Автор

thanks for explaining, i have a doubt :
is the order of direction while looping is necessary in case of bfs as well??

lunaticclips
Автор

this was really well explained in an organized manner, thank you

bishoysameh
Автор

how do i deal with looping in the maze, like a corner where it always turns left ?

pedromuniz
Автор

If our for loop begins with ' for direction in "EWSN" ' why does it go north if both the north and west direction are available? When west comes before north in our code.

This occurs also even when showing all paths taken in the demo code example.

blazeboi
Автор

the code for dfs is not working, its showing that it cannot find the key value

-taherbhurka
Автор

Thank you so much for this nice work!!!!

xphn
Автор

An excellent video my friend. I learned so much! Thank you for such a high quality lesson.

dallasdominguez
Автор

I would like your implementation to show the generated nodes and visited nodes and also the depth when live, could you tell me how to do it?

YankyFonteBoa
Автор

How do we get the csv file, is it like hardcoded?

rasikaburde
Автор

can we implement this code to java?ı mean ı want to create a random maze with java but ı cant find any resource to learn that

ceydaavc
Автор

this is very ell explained! How would i implement an iterative deepening depth first search? From my understanding I would need a depth counter. I'm new to python and would really appreciate some help!

yasminzamrin
Автор

What if middle of the map is the starting node?

xy
Автор

Very informative. Thanks for sharing. Please, I have a question relating to this topic and would like to contact you. How do I reach you? Thanks

jimmyloluolajide
Автор

very well eplained but can you make this same playlist but without using the "maze" for the explanation... im having hard time merging these two together because in my academics only graphs are mentioned.... one without mazes....

ghoritauheed