Repository contains the code for A* search algorithm visualised on a simple matplotlib graph
This is a gif showing examples of some paths.
The green block is the start coordinate and the red block is the end coordinate
A* is an extension of Dijkstra's algorithm. It works breadth-first search. This means that it is Dijkstra's algorithm but the search is in the direction of the end co-ordinate most of the time.
This helps speeding up the search and is particularly useful when the paths are huge and have many alternatives.
- Clone this repository into your working directory
- Run
AstarPlot.py
using the commandpython AstarPlot.py
- Enter your start-coordinates and end-coordinates. The code will shut down if the coordinates are an obstacle.
- Your matplotlib figure with the planned path will be shown.
- You can make your own obstacle grid by modifying the function
make_obstacles()
indraw_graph.py