The A search algorithm* is a best-first, informed search algorithm that guarantees finding an optimal path if an admissible and consistent heuristic is used. It operates by maintaining a priority queue of nodes to explore, prioritized by the sum f(n) = g(n) + h(n), where g(n) is the exact cost from the start node to node n, and h(n) is the heuristic estimate from n to the goal. This combination allows A* to systematically explore the most promising paths first, unlike uninformed algorithms like Dijkstra's Algorithm which explores uniformly.
Glossary
A* Search Algorithm

What is the A* Search Algorithm?
A* (pronounced "A-star") is a foundational graph traversal and pathfinding algorithm that efficiently finds the least-cost path from a start node to a goal node by combining actual traveled cost with a heuristic estimate of the remaining cost.
In robotics and motion planning, A* is often applied to discretized representations like grids or lattices to compute collision-free paths. Its efficiency and optimality make it a cornerstone for global planning, frequently used in conjunction with local planners like the Dynamic Window Approach (DWA). Variants like Weighted A* trade optimality for speed by inflating the heuristic, while implementations in libraries like the Open Motion Planning Library (OMPL) handle continuous configuration spaces (C-Space) through state sampling and collision checking.
Key Properties and Characteristics of A*
A* is distinguished from other graph search algorithms by its specific formulation and guarantees. These core properties define its optimality, efficiency, and practical application in robotics and motion planning.
Admissible Heuristic
An admissible heuristic is a condition where the estimated cost from any node n to the goal is never greater than the true cost. Formally, h(n) ≤ h*(n) for all n, where h*(n) is the true optimal cost-to-go. This property is the absolute requirement for A* to guarantee an optimal path. If a heuristic overestimates the cost, A* may find a suboptimal solution. In robotics, the Euclidean distance to the goal is a classic admissible heuristic for a robot moving in free space.
Consistency (Monotonicity)
A consistent (or monotone) heuristic satisfies the triangle inequality: h(n) ≤ c(n, n') + h(n') for every successor node n' of n, where c(n, n') is the step cost. Consistency is a stronger condition than admissibility. It guarantees that:
- The
f(n)cost (total estimated cost) is non-decreasing along any path. - The first time A* expands a node, it has found the optimal path to it.
- The algorithm does not need to re-open nodes from the closed set, simplifying implementation. Most well-designed heuristics in robotics, like Euclidean distance, are consistent.
Optimality Guarantee
Given an admissible heuristic, A* is guaranteed to find the globally optimal path from the start to the goal, provided a path exists. This is its most critical property for motion planning, where fuel, time, or wear must be minimized. The proof relies on the fact that A* expands nodes in order of their f(n) score. Since f(n) for the goal node is its true cost when using an admissible heuristic, any path with a higher cost will have a higher f score and be expanded later (or not at all).
Completeness
A* is complete on finite graphs with non-negative edge costs. This means it will always find a solution if one exists and will correctly terminate with failure if no path exists. Completeness is essential for reliable robotic systems; the planner must not silently fail. In infinite or continuous state spaces (like robot configuration space), basic A* is not directly applicable. However, when paired with a suitable discretization (e.g., a grid) or a sampling-based graph construction method, the overall planning approach retains this completeness property.
Cost Function: f(n) = g(n) + h(n)
A*'s decision-making is governed by the evaluation function f(n) = g(n) + h(n).
g(n)is the actual cost from the start node to noden. It represents the known, incurred cost.h(n)is the heuristic estimate of the cost fromnto the goal. It represents the informed "guess" about the remaining cost.f(n)is the estimated total cost of the cheapest solution throughn. The Open Set (frontier) is always ordered byf(n). This elegant combination of known past cost and estimated future cost is what balances thoroughness and directed search speed.
Trade-off: Heuristic Strength vs. Search Efficiency
The accuracy of the heuristic h(n) directly controls A*'s performance. The closer h(n) is to the true cost h*(n) (without overestimating), the fewer nodes A* will expand. At the extremes:
- If
h(n) = 0for alln, A* degenerates into Dijkstra's Algorithm, which is optimal but expands nodes in all directions equally (slow). - If
h(n) = h*(n)(perfect heuristic), A* expands only the nodes on the optimal path, achieving ideal efficiency. - In practice, a well-designed heuristic like straight-line distance provides a strong, admissible guide, making A* vastly more efficient than Dijkstra's for geometric pathfinding.
A* vs. Other Pathfinding Algorithms
A comparative analysis of A* against other fundamental pathfinding and graph search algorithms, highlighting their core mechanisms, guarantees, and typical use cases in robotics and motion planning.
| Feature / Metric | A* Search Algorithm | Dijkstra's Algorithm | Greedy Best-First Search | Rapidly-exploring Random Tree (RRT) |
|---|---|---|---|---|
Algorithm Type | Informed graph search | Uninformed graph search | Heuristic-driven graph search | Sampling-based planner |
Optimality Guarantee | ||||
Completeness Guarantee | ||||
Core Search Driver | f(n) = g(n) + h(n) (cost + heuristic) | g(n) (accumulated cost) | h(n) (heuristic to goal) | Random sampling & nearest-neighbor connection |
Heuristic Requirement | Admissible heuristic required for optimality | Not required | Required, but not for optimality | Not required |
Primary Use Case | Optimal pathfinding in known graphs (grids, road networks) | Single-source shortest paths in weighted graphs | Fast, satisficing paths where optimality is secondary | High-dimensional, non-convex spaces (robot arm C-space) |
Computational Complexity (Worst-case) | O(b^d), where b is branching factor, d is depth | O(|E| + |V| log |V|) with priority queue | O(b^m), where m is max depth | No explicit complexity; probabilistic completeness |
Typical Data Structure | Priority queue (min-heap) on f(n) | Priority queue (min-heap) on g(n) | Priority queue (min-heap) on h(n) | Tree (graph) in C-space |
Frequently Asked Questions
A* (pronounced 'A-star') is a foundational graph traversal and path search algorithm central to motion planning in robotics and AI. It is renowned for its efficiency and optimality guarantees, making it a cornerstone for navigation in both virtual and physical spaces.
The A search algorithm* is an informed graph traversal and pathfinding algorithm that finds the least-cost path from a start node to a goal node. It works by maintaining a priority queue of nodes to explore, ordered by a total cost function f(n) = g(n) + h(n), where g(n) is the actual 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, A* expands the node with the lowest f(n). It is both complete (will find a solution if one exists) and optimal (will find the lowest-cost path) provided the heuristic is admissible (never overestimates the true cost).
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 in Motion Planning
A* Search is a cornerstone of pathfinding. These related concepts define the algorithmic landscape it operates within, from foundational graph searches to advanced sampling-based planners.
Dijkstra's Algorithm
Dijkstra's algorithm is the foundational graph search method that guarantees the shortest path in a weighted graph with non-negative edges. It operates by systematically exploring nodes in order of their distance from the start.
- Key Difference from A:* It uses no heuristic; it explores uniformly in all directions.
- Computational Cost: It is often slower than A* for point-to-point queries as it explores a larger portion of the graph.
- Use Case: Optimal when no heuristic information is available or when finding the shortest path to all nodes from a single source.
Configuration Space (C-Space)
Configuration Space is the mathematical abstraction where every possible state (position, orientation, joint angles) of a robot is mapped to a single point. Obstacles in the physical world become forbidden regions in this space.
- Purpose: Transforms the complex geometric problem of moving a physical shape into the simpler problem of finding a path for a point.
- Dimensionality: Equal to the number of degrees of freedom (DOF) of the robot (e.g., 3 for a ground robot, 6+ for a manipulator).
- A's Domain:* A* searches for a path through the free regions of this C-Space graph.
Rapidly-exploring Random Tree (RRT)
Rapidly-exploring Random Tree (RRT) is a sampling-based algorithm designed for high-dimensional, non-convex spaces. It grows a tree by randomly sampling the C-Space and extending the tree toward these samples.
- Comparison to A:* RRT is probabilistically complete but not optimal; A* is optimal but requires a discrete graph.
- Strength: Excels in complex, continuous spaces where constructing a full graph for A* is infeasible.
- Common Variant: RRT* converges towards an optimal solution given sufficient time.
Probabilistic Roadmap (PRM)
Probabilistic Roadmap (PRM) is a sampling-based method that builds a graph (roadmap) of collision-free configurations in two phases: a learning phase and a query phase.
- Learning Phase: Randomly samples points in C-Space, connects nearby ones if a local path is collision-free.
- Query Phase: Uses a graph search like A* to find a path from start to goal on the constructed roadmap.
- Use Case: Ideal for multiple queries in a static environment, as the roadmap is built once and reused.
Heuristic Function (h(n))
The heuristic function, denoted h(n), estimates the cost from the current node n to the goal. It is the defining component that makes A* smarter than Dijkstra's algorithm.
- Admissibility: Must never overestimate the true cost to the goal (required for optimality).
- Common Heuristics: Euclidean distance (for planar navigation) or Manhattan distance (for grid worlds).
- Effect: A well-designed heuristic (closer to the true cost without overestimating) dramatically reduces the number of nodes A* must explore.
Open Motion Planning Library (OMPL)
The Open Motion Planning Library (OMPL) is a widely-used, open-source C++ library that provides a comprehensive suite of state-of-the-art motion planning algorithms, including implementations of A*, PRM, and RRT.
- Role: Provides a common framework for benchmarking and deploying planning algorithms in research and industry.
- Integration: Often used as the planning backend in the Robot Operating System (ROS) and other robotic software stacks.
- Resource: Developers can study and compare A* implementations alongside dozens of other planners. Learn more at the official repository: https://github.com/ompl/ompl

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