BusinessOS
Back to Videos

(Real Map) Dijkstra's Algorithm vs. A* Search

Watch on YouTube December 23, 2025 PT12S
2,942,817
Views
23,749
Likes
291
Comments
66.88x
Viral Ratio
onjsdev
44,000 subscribers · mid tier
View Channel
Full Description
Dijkstra’s Algorithm and A* Search both compute shortest paths on weighted graphs, but they differ in how they explore the search space: Dijkstra is uninformed and expands nodes purely by increasing path cost from the source, guaranteeing optimality but often exploring many unnecessary nodes, whereas A* is informed and prioritizes nodes using  f(n)=g(n)+h(n), where the haversine heuristic estimates the remaining great-circle distance to the goal. 

When the haversine heuristic is admissible and consistent (which it is for geographic distances without overestimation), A* remains optimal like Dijkstra but is typically far more efficient for routing problems on maps, as it focuses exploration toward the destination; however, if the heuristic provides little guidance or the goal is unspecified, A* effectively degrades to Dijkstra in behavior.

#computerscience #programming #computerengineering #python #javascript