Arc Consistency (AC-3) is a specific, widely-used algorithm for enforcing arc consistency, a fundamental local consistency property in Constraint Satisfaction Problems (CSPs). The algorithm operates on the constraint graph, systematically checking and revising arcs (directed constraint pairs) between variables to ensure that for every value in one variable's domain, there exists at least one compatible value in the neighboring variable's domain. This process of constraint propagation prunes the search space by eliminating locally inconsistent values, making subsequent backtracking search far more efficient.
Glossary
Arc Consistency (AC-3)

What is Arc Consistency (AC-3)?
Arc Consistency (AC-3) is a specific, widely-used algorithm for enforcing arc consistency, a local consistency property where, for every binary constraint, every value in a variable's domain has a compatible value in the domain of the other variable.
The AC-3 algorithm, introduced by Alan Mackworth in 1977, maintains a queue of arcs to be revised. When a domain is reduced, all arcs pointing to that variable are re-added to the queue to ensure propagation is complete. It achieves a time complexity of O(ed³) and space complexity of O(e), where e is the number of constraints and d is the maximum domain size. AC-3 is a core subroutine in more advanced algorithms like Maintaining Arc Consistency (MAC), which enforces full arc consistency at every node of a search tree to aggressively prune dead-ends.
Key Characteristics of AC-3
The AC-3 (Arc Consistency 3) algorithm is the seminal method for enforcing arc consistency, a core inference technique in constraint satisfaction. Its design prioritizes efficiency and systematic domain reduction.
Local Consistency Enforcement
AC-3 enforces arc consistency, a specific type of local consistency. For every binary constraint between two variables (X, Y), the algorithm ensures that for every value 'a' remaining in the domain of X, there exists at least one value 'b' in the domain of Y such that the pair (a, b) satisfies the constraint. This property is checked locally for each arc (directed constraint) but propagates globally as domains are reduced.
Worklist-Driven Propagation
The algorithm's core is a worklist (queue) of arcs to be revised. It begins with all arcs in the constraint graph. When the domain of a variable Y is reduced during a revision, all arcs pointing to Y (except the one just processed) are added back to the worklist. This ensures that changes propagate efficiently without redundant checks, making AC-3 sound (never removes a solution value) and complete for arc consistency (achieves the strongest possible domain reduction under this property).
Revise(X, Y) Function
The fundamental operation is the Revise(X, Y) function. For a given arc (X, Y):
- It inspects each value 'a' in the current domain of X.
- It checks if there exists any value 'b' in the domain of Y that satisfies the constraint C(X, Y).
- If no such 'b' exists for a given 'a', then 'a' is removed from the domain of X. The function returns true if the domain of X was actually changed. This boolean return drives the worklist propagation logic.
Time and Space Complexity
AC-3 has a worst-case time complexity of O(ed³) and a space complexity of O(e), where:
- e is the number of arcs (directed constraints) in the graph.
- d is the maximum size of any variable's initial domain.
The d³ factor arises because
Revisecan, in the worst case, check all d values in X against all d values in Y (d²), and an arc can be processed up to d times. In practice, with good heuristics and sparse constraints, performance is often far better.
Role in Search (MAC)
AC-3 is rarely used in isolation. Its primary role is as the inference engine inside Maintaining Arc Consistency (MAC), a complete search algorithm. In MAC, AC-3 (or a more advanced variant like AC-2001) is called at every node of the backtracking search tree after a variable assignment. This aggressively prunes future search space by eliminating values from unassigned variables that are now arc-inconsistent with the current partial assignment.
Comparison to Other AC Algorithms
AC-3 is simpler but less optimal than later algorithms:
- AC-1 & AC-2: Earlier, less efficient versions. AC-1 revisits all arcs after any change.
- AC-4: A more complex, optimal algorithm with O(ed²) worst-case time complexity. It uses counters and support lists to avoid redundant checks but has higher overhead and memory use (O(ed²)).
- AC-2001/3.1: Modern optimal variants that retain AC-3's simplicity by remembering a single latest supporting value for each (variable, value, constraint), achieving O(ed²) complexity. AC-3 remains the practical default due to its simplicity and good average-case performance.
Frequently Asked Questions
Essential questions and answers about the AC-3 algorithm, a cornerstone technique for efficiently solving Constraint Satisfaction Problems (CSPs) by enforcing local consistency.
The AC-3 algorithm is a specific, widely-used procedure for enforcing arc consistency, a local consistency property in Constraint Satisfaction Problems (CSPs). It works by iteratively processing a queue of arcs (directed constraints between two variables). For each arc (Xi, Xj), the algorithm examines each value v in the domain of Xi to see if there exists at least one compatible value in the domain of Xj that satisfies the binary constraint between them. If a value v has no supporting value in Xj's domain, v is removed from Xi's domain. This removal may make other arcs inconsistent, so they are added back to the queue. The algorithm terminates when the queue is empty (a fixed point is reached) or if a variable's domain becomes empty (proving inconsistency).
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
Arc Consistency (AC-3) is a core algorithm within a broader ecosystem of techniques for solving Constraint Satisfaction Problems. Understanding these related concepts is essential for engineers designing scheduling, configuration, and logistics agents.
Constraint Propagation
Constraint propagation is the overarching inference technique that uses the logical relationships defined by constraints to reduce the search space. It works by iteratively eliminating values from variable domains that cannot participate in any solution. AC-3 is a specific, efficient algorithm for enforcing one type of propagation: arc consistency. Other forms include node consistency (unary constraints) and path consistency (triples of variables).
Maintaining Arc Consistency (MAC)
Maintaining Arc Consistency (MAC) is a complete search algorithm that powerfully combines backtracking search with full arc consistency enforcement. At each node in the search tree (after each variable assignment), MAC runs an algorithm like AC-3 to prune the domains of future variables. This aggressive pruning often makes MAC significantly more efficient than vanilla backtracking, though it incurs higher computational cost per node. It's a standard algorithm for solving difficult CSPs.
k-Consistency
k-Consistency is a generalized hierarchy of local consistency properties. A CSP is k-consistent if, for any set of k-1 variables with a consistent assignment, a consistent value can always be found for any k-th variable.
- 1-Consistency (Node Consistency): Each value satisfies the variable's unary constraints.
- 2-Consistency (Arc Consistency): The property enforced by AC-3.
- 3-Consistency (Path Consistency): Extended to triples of variables. Enforcing higher levels of k-consistency is more powerful but computationally expensive.
Constraint Optimization Problem (COP)
A Constraint Optimization Problem (COP) extends a standard CSP by adding an objective function that must be maximized or minimized. The goal is no longer to find any feasible solution, but the best one according to a metric (e.g., minimize cost or maximize efficiency). Solving COPs often involves techniques like branch and bound on top of constraint propagation. AC-3 remains relevant for pruning infeasible regions of the search space during optimization.
Local Search (Min-Conflicts)
Local search algorithms like the min-conflicts heuristic represent a different, incomplete approach to solving CSPs compared to systematic search with AC-3. They start with a complete but potentially invalid assignment and iteratively improve it. At each step, the algorithm selects a conflicted variable and changes its value to the one that results in the minimum number of conflicts with other variables. This method is highly effective for large-scale problems like scheduling and is famously used for the n-queens problem.
Boolean Satisfiability (SAT & CDCL)
The Boolean Satisfiability Problem (SAT) is a canonical NP-complete CSP where variables are Boolean and constraints are clauses. Modern SAT solvers use the Conflict-Driven Clause Learning (CDCL) algorithm, which shares conceptual parallels with CSP techniques. CDCL performs a form of constraint propagation (unit propagation), encounters conflicts, analyzes them to learn new constraints (clauses), and then performs non-chronological backtracking. This is analogous to intelligent backtracking schemes in CSPs like Conflict-Directed Backjumping.

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