A* Algorithm
Updated 2026-07-30
Summary
The A* search algorithm is an algorithm for finding the lowest-cost path on a graph plane with multiple nodes. It is commonly used in NPC movement calculations in games, or in the movement calculations of bots in online games. The algorithm combines the advantages of best-first search and Dijkstra's algorithm: it improves efficiency through heuristic search while guaranteeing an optimal path (provided the heuristic function is admissible and consistent). In this algorithm, if g(n) represents the actual cost from the start node to any vertex n, ...
Definition
F = G + H. G: the actual cost from the start to the current node. H: the estimated cost from the current node to the goal (heuristic function). Scaffold use: finding a path with a map. Dijkstra's algorithm is blind search (like a headless fly), while A* introduces H (estimation), which is equivalent to knowing the general direction of the goal, thus achieving the highest search efficiency.
Introduction
How to use
Finding a path with a map. Dijkstra's algorithm is blind search (like a headless fly), while A* introduces H (estimation), which is equivalent to knowing the general direction of the goal, thus achieving the highest search efficiency.
Mechanism
Based on 'best-first search'. F=G+H, where G is the actual cost and H is the heuristic estimate; a priority queue is used to expand the node with the smallest F, balancing optimality and efficiency.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- Game pathfinding/map navigation uses A* to efficiently find the shortest path.
Common pitfalls
- If H is too large, it degenerates into greedy search and does not guarantee optimality; if H is too small, it degenerates into Dijkstra and becomes slower; ignoring admissibility.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/A%2A%E6%90%9C%E5%B0%8B%E6%BC%94%E7%AE%97%E6%B3%95verified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS