Iterative Deepening A (IDA)** is a memory-efficient graph search and pathfinding algorithm that combines the space efficiency of iterative deepening depth-first search (IDDFS) with the heuristic guidance of the A algorithm*. It operates by performing a series of depth-first searches, each bounded by a progressively increasing cost threshold (f-cost), defined as f(n) = g(n) + h(n), where g(n) is the actual cost from the start and h(n) is a heuristic estimate to the goal. This threshold-based approach ensures optimality when the heuristic is admissible, while requiring memory linear only in the depth of the solution.
Glossary
Iterative Deepening A* (IDA*)

What is Iterative Deepening A* (IDA*)?
A memory-optimized pathfinding algorithm that merges the heuristic guidance of A* with the space efficiency of depth-first iterative deepening.
The algorithm is particularly valuable in agentic cognitive architectures where agents must plan complex sequences under strict memory constraints, such as on-edge hardware. Unlike standard A*, which maintains an open list of all frontier nodes, IDA* discards nodes once a search iteration completes, dramatically reducing its memory footprint. Its primary trade-off is the potential re-exploration of nodes across iterations, increasing time complexity in exchange for guaranteed space efficiency, making it ideal for searching large state spaces where memory is the limiting resource.
Key Characteristics of IDA*
Iterative Deepening A* (IDA*) is a memory-optimal heuristic search algorithm that combines the systematic threshold-based approach of iterative deepening with the informed guidance of A* search.
Iterative Deepening with a Cost Threshold
IDA* operates by performing a series of depth-first searches (DFS) with an increasing cost threshold (f-cost). The f-cost for a node is calculated as f(n) = g(n) + h(n), where g(n) is the actual cost from the start, and h(n) is the heuristic estimate to the goal.
- The algorithm begins with a threshold equal to the heuristic estimate of the start state:
threshold = h(start). - It performs a DFS that prunes any branch where
f(n) > threshold. - If the goal is not found, the threshold is increased to the minimum f-cost that exceeded the previous threshold among all pruned nodes, and the search repeats.
This iterative process guarantees that the first solution found is optimal if the heuristic is admissible.
Memory Efficiency of DFS
The primary advantage of IDA* over standard A* is its extremely low memory footprint. While A* must maintain an open list (frontier) and a closed list (explored set), IDA* only needs to store the current path from the root to the active node on the recursion stack.
- Space Complexity: O(d), where
dis the depth of the solution. This is linear in the depth, compared to A*'s O(b^d) in the worst case for storing all explored nodes. - This makes IDA* suitable for problems with massive state spaces where storing the entire explored graph is infeasible.
- The trade-off is the recomputation of nodes in each iteration, as the DFS does not remember previously visited states across iterations.
Admissible Heuristic Requirement
Like A*, IDA* requires the heuristic function h(n) to be admissible to guarantee an optimal solution. An admissible heuristic never overestimates the true cost to reach the goal.
- Consistency/Monotonicity: While not strictly required for correctness, a consistent heuristic (where
h(n) ≤ c(n, n') + h(n')for all successorsn') ensures thatf(n)is non-decreasing along any path. This improves efficiency in IDA* by reducing the number of node re-expansions. - If the heuristic is not admissible, IDA* may find a solution, but it will not be guaranteed to be the cheapest path.
- Common admissible heuristics include Euclidean distance for pathfinding on a plane or Manhattan distance for grid-world problems with 4-directional movement.
The Threshold Update Mechanism
The intelligence of IDA* lies in how it updates the cost threshold between iterations. It is not simply incremented by a fixed amount.
- During a depth-first search, the algorithm tracks the minimum f-cost encountered that exceeded the current threshold. This value is often called the next_threshold or flimit.
- When the DFS completes without finding the goal, the threshold for the next iteration is set to this
next_threshold. - This ensures each iteration explores all nodes with an f-cost less than or equal to the new threshold, systematically exploring the state space in order of increasing f-cost, mirroring A*'s optimal expansion order.
- This update rule is what allows IDA* to be both complete and optimal.
Performance & Practical Considerations
IDA*'s performance is a direct trade-off between time and space. Its time complexity is difficult to state precisely but is generally higher than A*'s due to node re-expansion.
- Time Complexity: In the worst case, it can be O(b^d), where
bis the branching factor anddis the solution depth. However, with a good heuristic, it is often far better. - Major Drawback: If the heuristic provides little guidance or if the cost function has many distinct values, IDA* can suffer from excessive node regeneration, leading to long runtimes. For example, in a tree with a unique f-cost for each node, IDA* may perform a new DFS for every node on the solution path.
- Optimizations: Techniques like transposition tables (to cache visited states) or recursive best-first search (RBFS) can mitigate recomputation overhead but reintroduce memory usage.
Comparison with A* and Other Algorithms
IDA* occupies a specific niche in the heuristic search landscape.
- vs. A Search*: IDA* is memory-optimal but generally slower due to recomputation. Use IDA* when the state space is too large for A*'s memory requirements.
- vs. Iterative Deepening DFS (IDDFS): IDA* is informed by a heuristic, making it exponentially faster than uninformed IDDFS on many problems.
- vs. Recursive Best-First Search (RBFS): Both are linear-space algorithms. RBFS uses slightly more memory to store sibling
f-limitsand often regenerates fewer nodes than IDA*, but its implementation is more complex. - Typical Applications: IDA* is historically famous for solving the 15-puzzle and other single-agent puzzle problems. It is less common in real-time applications like video game pathfinding due to its unpredictable, iteration-based runtime.
IDA* vs. A* Search: Algorithm Comparison
A direct comparison of the core algorithmic properties, performance characteristics, and ideal use cases for Iterative Deepening A* and the standard A* search algorithm.
| Feature / Metric | Iterative Deepening A* (IDA*) | A* Search |
|---|---|---|
Primary Data Structure | Recursive call stack (DFS) | Priority queue (Open/Closed sets) |
Memory Complexity | O(d) | O(b^d) |
Completeness | ||
Optimality (with admissible heuristic) | ||
Primary Limiting Factor | Time (repeated node expansions) | Memory (node storage) |
Typical Use Case | Large state spaces with limited memory (e.g., puzzle solving, theorem proving) | Pathfinding on explicit graphs (e.g., game maps, network routing) |
Handles Graphs with Cycles | ||
Requires Storing All Visited Nodes |
Frequently Asked Questions
Iterative Deepening A* (IDA*) is a memory-efficient graph search and pathfinding algorithm that combines the space efficiency of iterative deepening depth-first search with the heuristic guidance of the A* algorithm, using a cost threshold that increases with each iteration. This FAQ addresses its core mechanisms, applications, and trade-offs for developers and system architects.
Iterative Deepening A* (IDA*) is a memory-optimized, heuristic graph search algorithm that finds the lowest-cost path by performing a series of depth-first searches (DFS) with successively increasing cost thresholds. It works by defining a cost threshold (often denoted as f-limit), which is the maximum allowed f-cost (f(n) = g(n) + h(n)) for any node in the current iteration. The algorithm performs a DFS that prunes any branch where the f-cost of a node exceeds this threshold. If the goal is not found, the threshold is increased to the minimum f-cost that was pruned in the previous iteration, and the DFS is repeated. This process continues until the goal node is found and its path cost is less than or equal to the current threshold, guaranteeing an optimal solution if the heuristic is admissible.
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
Iterative Deepening A* (IDA*) is a core algorithm within the heuristic search family, designed for optimal pathfinding under strict memory constraints. Understanding its related concepts is essential for engineers designing efficient agent planning and decision-making systems.
A* Search
A Search* is the foundational best-first pathfinding algorithm upon which IDA* is built. It finds the lowest-cost path by evaluating nodes using the function f(n) = g(n) + h(n), where g(n) is the exact cost from the start node and h(n) is a heuristic estimate to the goal. Unlike IDA*, A* typically requires storing the entire open list and closed list in memory, which can be prohibitive for large state spaces. IDA* was created to preserve A*'s optimality and heuristic guidance while eliminating its memory footprint.
Iterative Deepening
Iterative Deepening is a general search strategy that performs a series of depth-limited depth-first searches (DFS), incrementally increasing the depth limit. This approach combines the completeness and optimality (for uniform-cost trees) of breadth-first search with the linear memory efficiency of DFS. IDA* adapts this core idea, but instead of using a simple depth limit, it uses a cost threshold (f-cost) based on the A* evaluation function, making it suitable for weighted graphs.
Depth-First Search (DFS)
Depth-First Search (DFS) is a fundamental graph traversal algorithm that explores as far as possible along a branch before backtracking, using a stack (implicitly via recursion) to manage the frontier. IDA*'s underlying exploration mechanism is a depth-first search, but it is guided by a cost threshold and a heuristic. This allows IDA* to inherit DFS's memory efficiency—it only needs to store the current path, requiring O(d) memory where d is the depth of the solution—while being far more directed and optimal.
Heuristic Function (Admissible/Consistent)
A heuristic function, h(n), estimates the cost from a node n to the nearest goal. For IDA* (and A*) to guarantee an optimal solution, the heuristic must be admissible (never overestimates the true cost) and ideally consistent (monotonic).
- Admissibility ensures the algorithm does not miss a better path.
- Consistency ensures that the f-cost is non-decreasing along any path, which is critical for IDA*'s iterative threshold increases to work correctly. Poor heuristics can cause IDA* to degrade to exhaustive iterative deepening.
Recursive Best-First Search (RBFS)
Recursive Best-First Search (RBFS) is another memory-limited search algorithm designed as a more efficient alternative to IDA*. It operates similarly to a recursive best-first search but keeps track of a second-best f-value (an alternative) for each node to allow intelligent backtracking. Compared to IDA*:
- RBFS can be more efficient as it uses stored f-cost information to avoid re-exploring entire subtrees.
- IDA* is often simpler to implement and can have lower overhead per node, but may re-explore significant portions of the state space with each iteration.
Search Space & State Space
The search space is the set of all possible states and transitions a search algorithm like IDA* must explore. The state space is its formal representation, defined by:
- An initial state (the start node).
- A successor function (generates possible next states/actions).
- A goal test.
- A path cost function. IDA* is particularly advantageous when this space is large or infinite and memory is constrained. Its efficiency is highly dependent on the branching factor and the quality of the heuristic used to prune the space.

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