Graph search algorithms like Dijkstra’s Algorithm and A* work on weighted directed graphs, sets of nodes connected by edges that have numeric weights (movement costs) attached to them. Can they also work on grids? Yes: a grid can be viewed as a special case of a graph.| www.redblobgames.com
Apr 2014, updated Feb 2015, May 2020, May 2024Running Breadth First Search with multiple start points can do some cool things. If you haven’t already read my page about Breadth First Search, that would be the place to start before reading this page. The ideas here are a modification of the algorithm presented there. Note that even though the demos on this page use a square grid, none of these algorithms is limited to only square grids, or even to grids.| www.redblobgames.com
Interactive tutorial for A*, Dijkstra's Algorithm, and other pathfinding algorithms| www.redblobgames.com
PEP 484 introduced type hints, a.k.a. type annotations. While its main focus was function annotations, it also introduced the notion of type comments to annotate variables:| Python Enhancement Proposals (PEPs)