Breadth First Search (BFS) in Python [Python Maze World- pyamaze]
Vložit
- čas přidán 4. 07. 2024
- 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 Breadth First Search (BFS).
(00:00) Introduction
(03:22) What is Queue
(04:49) Pseudocode
(08:18) Python Code Development
⭐⭐Depth First Search (DFS) Implementation:
• Depth First Search (DF...
⭐⭐A-star (A*) Search Implementation:
• A-Star A* Search in Py...
⭐⭐Comparison of DFS, AFS and A*
• DFS BFS and A* Search ...
⭐⭐Dijkstra's Algorithm:
• Dijkstra Shortest Path...
You can download the package as:
pip install pyamaze
Or you can copy the module code from here:
github.com/MAN1986/pyamaze/bl...
The used demo file is here :
github.com/MAN1986/pyamaze/tr...
How to use pyamaze module:
• Maze Generation and Se...
What is __name__=='__main__':
• [Python Programming Ba...
Here is the Playlist:
• AI Search Algorithms u...
#Python #pyamaze #Python
bro you was so useful
Kudoos Bro! Loved to see such a clear and illustrative explanation by a fellow Pakistani CS lad 🇵🇰💚
Thanks a ton 💚
Very clear tutorial..may Allah bless you..
Jazak Allah
Another fantastic tutorial 👍
Thanks again! 🙂
Ma Sha ALLAH Sir
Thanks !
Is there any way to find all posible paths?
what's the point of the queue module if we can pretty easily simulate the behavior of a queue using list?
As far result is concerned both are giving the same output but popping an element from queue or deque is faster as compared to list.
We can perform all set operations using the list, but the set operations defined in Set class are much faster than that of the list and that is the reason to have the Set class.
Same goes for queue and deque i.e. fast result.
@@LearningOrbis nice info bro
salamo alaykom thank you my brother for your clear explaination
WaAlaikumSalam,
Thanks a lot and stay connected for more Maze search algorithms!
@@LearningOrbis
I have a question, can I apply your algorithm in order to solve knapsack problem?
As far this module is concerned, it is created for Maze problems. But in general you can use BFS, DFS or Branch and Bound to solve Knapsack problem.
Check this out:
cs.franklin.edu/~shaffstj/cs319/week12.htm#Breadth-First%200-1%20Knapsack%20Problem
@@LearningOrbis
absolutely
At the end of pseudo code when you have found the goal cell,then how to traverse from (5,5) to (1,1)?
I have explained that from 12:18
Hello, I found your documentation very useful but can you tell me more about how to handle it if someone wants to enter input and end points from the keyboard?
Sorry that option is not included!
@@LearningOrbis So that means the above method can only illustrate the available algorithm with given points and cannot be entered from the keyboard, right? I need some way to help users enter from the keyboard :((
You can change the start and goal, size of maze etc, but with the code. Have you seen the first video where I have explained everything?
czcams.com/video/McMU-WuJwG0/video.html
What if a cell is allowed to be visited at most thrice? How to implement this in the code?
If you watch the first video of the playlist, you will understand the use of pyamaze module. The different search algorithms implemented in the playlist are the demo used cases of pyamaze and in fact you can implement any of your logic as you mentioned.
This is the introductory video:
czcams.com/video/McMU-WuJwG0/video.html
possible ways in diagonal means...? how to code?
You mean the agent could move diagonally?
Sorry, diagonal movement not included 😐
how i run the folder from the github
I have explained the use here:
czcams.com/video/McMU-WuJwG0/video.html
Used this very differently. Created a custom maze like a car park and spawned actors as parked vehicles. Then used BFS to get the closest unused parking location. But the goal point is not being pushed to the bfs_path so i get a trace error saying the ksy cannot be found. Still trouble shooting it tho. Would see what I can do about this as i need to add 3 more vehicles and search the closest parking spot for a total of 4 vehicles . I will also upload code to github and share
Does the code in the video give the complete solution?
Yes.
BFS gives same path as DFS
If we have multiple paths, the BFS will give the shortest path and DFS might not give that path.
When there is just one path then obviously both will give the same path.