Five pathfinding algorithms, one route across Berlin: Checkpoint Charlie down
Five pathfinding algorithms, one route across Berlin: Checkpoint Charlie down
to Tempelhof. Same 47,737-node street graph, same 5.71 km answer. What changes
is how much of the city each one has to look at first.
Dijkstra opens 34,494 of those nodes. It grows a circle outward in every
direction because it has no idea which way Tempelhof is. A* adds one thing
(a straight-line guess at the distance still to go) and finds the identical
route after 4,368.
Greedy best-first only ever chases that guess and forgets what the trip has
already cost. It does the least work of anything here, 878 nodes, and hands
back a route 3.7 km longer, because it walked straight at Tempelhofer Feld and had to come back
around.
Search from both ends at once and it’s 3,058. Same shortest route Dijkstra
found, 11× less of the map touched.
#didyouknow #tech #pathfinder #satisfying #animation
Comments
Comments from the original post on Instagram
No comments yet
