The A algorithm* is a best-first search algorithm that finds the least-cost path from a start node to a goal node in a weighted graph by combining the cost to reach a node (g(n)) with a heuristic estimate of the cost to the goal (h(n)). It prioritizes expanding the most promising node, defined by the lowest total estimated cost f(n) = g(n) + h(n), ensuring optimality when the heuristic is admissible (never overestimates). This makes it exceptionally efficient for problems like robotic navigation and vehicle routing.
Glossary
A* Algorithm

What is the A* Algorithm?
The A* (pronounced "A-star") algorithm is the foundational graph traversal and path search method for optimal navigation in robotics and logistics.
In heterogeneous fleet orchestration, A* forms the core of many real-time replanning engines. It is often used as a subroutine within more complex frameworks like Lifelong Planning A (LPA)** for incremental updates or Space-Time A* for multi-agent scheduling. Its performance hinges on the heuristic's quality; common choices include the Euclidean or Manhattan distance, which provide the necessary admissibility for grid-based warehouse navigation and ensure deterministic, optimal pathfinding for autonomous mobile robots.
Core Components of the A* Algorithm
The A* algorithm's efficiency stems from its structured combination of graph search and heuristic guidance. These core components define its optimality guarantees and computational behavior.
Heuristic Function (h(n))
The heuristic function, denoted h(n), estimates the cost from a given node n to the goal. It is the algorithm's 'informed guess' that guides the search toward the goal. For A* to be optimal (find the shortest path), the heuristic must be admissible (never overestimates the true cost) and consistent (obeys the triangle inequality). Common examples include:
- Euclidean distance for planar movement.
- Manhattan distance for grid-based movement (e.g., warehouse robots moving along aisles).
- Diagonal distance (Chebyshev distance) for 8-direction grid movement.
Cost Function (g(n))
The cost function, g(n), represents the exact, accumulated cost from the start node to the current node n. This is a known, concrete value calculated during the search by summing the edge weights of the traversed path. It ensures the algorithm accounts for the actual distance traveled, providing the foundation for proving path optimality. In logistics, this cost can incorporate:
- Travel distance.
- Traversal difficulty (e.g., different floor surfaces).
- Time-based penalties.
Evaluation Function (f(n))
The evaluation function, f(n) = g(n) + h(n), is the core priority metric. A* expands the node with the lowest f(n) value from the open set. This balance is critical:
- g(n) ensures the path to the node is already short.
- h(n) steers the search toward the goal. This combination allows A* to prune large sections of the search space that Dijkstra's algorithm would explore, making it dramatically more efficient for point-to-point navigation.
Open and Closed Sets
A* maintains two primary data structures to manage the search frontier and explored nodes:
- Open Set (Frontier): Typically a priority queue (e.g., a min-heap) ordered by f(n). It contains nodes discovered but not yet expanded. The algorithm always expands the node with the lowest f(n).
- Closed Set (Explored): A set (e.g., a hash table) containing nodes that have already been expanded. This prevents redundant work by ensuring each node is processed only once, provided the heuristic is consistent. Efficient management of these sets is crucial for performance in large graphs.
Optimality and Completeness
A* is both complete and optimal under standard conditions.
- Completeness: It will always find a solution if one exists, given finite branching and a finite graph.
- Optimality: It guarantees the found path is the lowest-cost path. This holds true if the heuristic function h(n) is admissible. If h(n) is also consistent, the algorithm is optimally efficient, meaning no other optimal algorithm is guaranteed to expand fewer nodes. This makes A* the foundational choice for deterministic pathfinding in known environments.
Computational Complexity & Trade-offs
In the worst case, A*'s time and space complexity are O(b^d), where b is the branching factor and d is the depth of the solution, equivalent to an uninformed search. However, a good heuristic dramatically reduces the effective branching factor in practice. The primary trade-off is:
- Heuristic Accuracy: A more accurate heuristic (closer to the true cost without overestimating) results in far fewer node expansions and faster search. The ideal heuristic is the exact remaining cost, which would lead to a direct path to the goal.
- Heuristic Computation Cost: The time to compute h(n) must be negligible compared to the cost of graph operations, or it becomes a bottleneck.
How the A* Algorithm Works: Step-by-Step
The A* algorithm is a foundational graph traversal and path search algorithm used extensively in robotics and real-time replanning engines to find the least-cost path from a start node to a goal node.
The algorithm operates as a best-first search, guided by a cost function f(n) = g(n) + h(n). The g(n) term represents the exact cost from the start node to the current node n. The heuristic function h(n) estimates the cost from n to the goal. A* efficiently explores the most promising paths first by always expanding the node with the lowest f(n) value, stored in an open set typically implemented as a priority queue. This guarantees an optimal path if the heuristic is admissible (never overestimates the true cost) and consistent.
The search proceeds iteratively: it pops the best node from the open set, checks if it is the goal, and if not, expands it by generating all valid successor nodes. For each successor, it calculates a tentative g-score. If this score is better than a previously recorded one, it updates the node's cost and parent pointer, placing it in the open set. Processed nodes move to a closed set to avoid re-evaluation. The algorithm terminates when the goal is reached or the open set is empty, indicating no path exists. Its efficiency makes it a core component in lattice planners and incremental variants like Lifelong Planning A (LPA)** for dynamic environments.
Real-World Applications of A*
The A* algorithm's efficiency and optimality make it a cornerstone for real-time pathfinding and planning in dynamic, physical environments. Its applications span from video games to critical robotics and logistics systems.
Video Game AI & NPC Navigation
A* is the industry-standard algorithm for non-player character (NPC) pathfinding in strategy, role-playing, and real-time strategy games. It efficiently calculates optimal paths across grid-based or navmesh representations of complex game worlds.
- Core Function: Guides units around static terrain and dynamic obstacles like other characters.
- Optimization: Often paired with hierarchical pathfinding, where A* plans a high-level route between regions, and a faster local planner handles the final steps.
- Example: Used in classics like StarCraft and modern engines (Unity, Unreal) for deterministic, believable unit movement.
Autonomous Mobile Robot (AMR) Navigation
In warehouse and factory automation, A* plans the base routes for Autonomous Mobile Robots (AMRs) transporting goods. It operates on a discretized map of the facility, finding the shortest path between pick-up and drop-off points.
- Integration: Serves as the global planner, generating the reference path. Local planners (like Dynamic Window Approach or Model Predictive Control) then handle real-time obstacle avoidance and smooth trajectory execution.
- Critical for Orchestration: Within Heterogeneous Fleet Orchestration platforms, A* provides the initial feasible plan that real-time replanning engines (e.g., D Lite*) can efficiently adjust when encountering dynamic obstacles like manual forklifts or other AMRs.
GPS Navigation & Route Planning
Digital mapping services (e.g., Google Maps, OpenStreetMap) use variants of A* for calculating driving, walking, and cycling directions. The road network is modeled as a graph where intersections are nodes and road segments are weighted edges (cost = travel time/distance).
- Heuristic Power: The straight-line distance to the destination provides an excellent, admissible heuristic, allowing the algorithm to quickly prune inefficient routes.
- Scale Handling: For continent-scale routing, hierarchical techniques are employed, but A* remains fundamental for regional or final-mile path calculation.
Robotic Arm Motion Planning
For robotic manipulators, A* can be applied in configuration space (C-space), where each node represents a vector of joint angles. It finds a sequence of joint movements to move the end-effector from a start to a goal pose while avoiding self-collisions and environmental obstacles.
- Challenge: C-space is high-dimensional, making naive search intractable. This is often addressed by combining A* with sampling-based methods or using it to search a graph of pre-computed motion primitives.
- Role in Replanning: If an obstacle enters the workspace, an incremental algorithm like Lifelong Planning A (LPA)** can repair the A*-generated path efficiently.
Network Routing Protocols
In telecommunications, A* principles are applied in network routing algorithms (e.g., QoS routing) to find the optimal path for data packets through a network of routers. Link cost can be a function of bandwidth, latency, or packet loss.
- Analogy: Routers are nodes, connections are edges. The heuristic might be the minimum possible hop count or latency to the destination network.
- Dynamic Adaptation: In software-defined networks, the 'cost' of edges can change dynamically, requiring the kind of incremental replanning for which algorithms like D* were inspired.
Puzzle Solving & AI Planning
A* is a fundamental algorithm in classical AI for solving state-space search problems, such as the 15-puzzle, Rubik's Cube, or logistical planning problems. Each game state is a node, and legal moves are edges.
- Heuristic Design: Success depends on a well-designed admissible heuristic. For the 15-puzzle, the Manhattan distance of each tile to its goal is a common heuristic.
- Foundation for Advanced Planners: It demonstrates the core best-first search paradigm that underpins more complex kinodynamic planners and Multi-Agent Path Finding (MAPF) algorithms like Conflict-Based Search (CBS), which often use A* at the low level for individual agent planning.
A* vs. Other Pathfinding Algorithms
A comparison of key algorithmic characteristics for real-time replanning in heterogeneous fleet orchestration, focusing on optimality, completeness, and suitability for dynamic environments.
| Algorithmic Feature | A* (A-Star) | Dijkstra's Algorithm | Greedy Best-First Search | Rapidly-exploring Random Tree (RRT) |
|---|---|---|---|---|
Algorithm Type | Informed search (heuristic + cost) | Uninformed search (cost only) | Informed search (heuristic only) | Sampling-based motion planning |
Optimality Guarantee | ||||
Completeness Guarantee | ||||
Primary Use Case | Optimal pathfinding in known graphs | Single-source shortest paths | Fast, suboptimal pathfinding | High-dimensional/kinodynamic planning |
Heuristic Function Required | ||||
Suitability for Dynamic Replanning | ||||
Incremental Replanning Variant | Lifelong Planning A* (LPA*) | RRT* | ||
Typical Computational Complexity | O(b^d) where h is good | O((V+E) log V) | O(b^m) | Probabilistically complete |
Path Smoothness Output | Graph-dependent waypoints | Graph-dependent waypoints | Graph-dependent waypoints | Requires post-processing |
Frequently Asked Questions
The A* algorithm is a foundational pathfinding and graph traversal method used extensively in robotics, video games, and logistics for finding optimal routes. These questions address its core mechanics, applications, and role in modern real-time replanning systems.
The A* algorithm is a best-first search algorithm that finds the least-cost path from a start node to a goal node in a weighted graph. It works by maintaining a priority queue of nodes to explore, ordered by a cost function f(n) = g(n) + h(n), where g(n) is the exact cost from the start node to node n, and h(n) is a heuristic function estimating the cost from n to the goal. At each step, it expands the node with the lowest f(n). If the heuristic is admissible (never overestimates the true cost) and consistent, A* is guaranteed to find an optimal path.
Key Process:
- Initialize open and closed sets.
- Add the start node to the open set with
f(start) = h(start). - While the open set is not empty:
- Pop the node with the lowest
f(n). - If it is the goal, reconstruct the path.
- Generate its successors, calculate their
g,h, andfvalues. - If a successor is new or offers a better
gcost, update it and add it to the open set.
- Pop the node with the lowest
- Return failure if the goal is unreachable.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
The A* algorithm is a foundational component within real-time replanning engines. The following terms represent key algorithms, frameworks, and concepts used alongside or as alternatives to A* in dynamic, multi-agent environments.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us