A Comparison of Structural CSP Decomposition Methods

Similar documents
PART 1 GRAPHICAL STRUCTURE

Acyclic Network. Tree Based Clustering. Tree Decomposition Methods

Scan Scheduling Specification and Analysis

Treewidth and graph minors

Unifying and extending hybrid tractable classes of CSPs

Chordal deletion is fixed-parameter tractable

Acyclic Network. Tree Based Clustering. Tree Decomposition Methods

The Encoding Complexity of Network Coding

Summary. Acyclic Networks Join Tree Clustering. Tree Decomposition Methods. Acyclic Network. Tree Based Clustering. Tree Decomposition.

Structure and Complexity in Planning with Unary Operators

Some Applications of Graph Bandwidth to Constraint Satisfaction Problems

Reducing redundancy in the hypertree decomposition scheme

On the Parallel Complexity of Structural CSP Decomposition Methods

On the Space-Time Trade-off in Solving Constraint Satisfaction Problems*

The Tractability of Global Constraints

SFU CMPT Lecture: Week 8

3 No-Wait Job Shops with Variable Processing Times

Consistency and Set Intersection

Constraint Solving by Composition

On Universal Cycles of Labeled Graphs

Rigidity, connectivity and graph decompositions

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006

Faster parameterized algorithms for Minimum Fill-In

An Extension of Complexity Bounds and Dynamic Heuristics for Tree-Decompositions of CSP

An Effective Upperbound on Treewidth Using Partial Fill-in of Separators

Computing optimal linear layouts of trees in linear time

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È.

A Game-Theoretic Approach to Constraint Satisfaction

Disjoint, Partition and Intersection Constraints for Set and Multiset Variables

Recognizing Interval Bigraphs by Forbidden Patterns

Probabilistic analysis of algorithms: What s it good for?

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

On Covering a Graph Optimally with Induced Subgraphs


a standard database system

Parameterized graph separation problems

Response Time Analysis of Asynchronous Real-Time Systems

RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È.

9. Parameter Treewidth

1. Lecture notes on bipartite matching

The External Network Problem

Faster parameterized algorithms for Minimum Fill-In

Constraint Satisfaction Problems

Class2: Constraint Networks Rina Dechter

Online Facility Location

Worst-Case Utilization Bound for EDF Scheduling on Real-Time Multiprocessor Systems

On the Space-Time Trade-off in Solving Constraint Satisfaction Problems*

Core Membership Computation for Succinct Representations of Coalitional Games

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

Necessary edges in k-chordalizations of graphs

Complexity Results on Graphs with Few Cliques

On 2-Subcolourings of Chordal Graphs

COMP260 Spring 2014 Notes: February 4th

Applied Mathematics Letters. Graph triangulations and the compatibility of unrooted phylogenetic trees

9 About Intersection Graphs

Theorem 2.9: nearest addition algorithm

Graphs (MTAT , 4 AP / 6 ECTS) Lectures: Fri 12-14, hall 405 Exercises: Mon 14-16, hall 315 või N 12-14, aud. 405

1 Inference for Boolean theories

Conflict Graphs for Combinatorial Optimization Problems

arxiv: v4 [math.co] 25 Apr 2010

From Static to Dynamic Routing: Efficient Transformations of Store-and-Forward Protocols

Fully dynamic algorithm for recognition and modular decomposition of permutation graphs

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Module 11. Directed Graphs. Contents

Coloring edges and vertices of graphs without short or long cycles

R E P O R T. Heuristic Methods for Hypertree Decompositions INSTITUT FÜR INFORMATIONSSYSTEME DBAI-TR

Mathematical and Algorithmic Foundations Linear Programming and Matchings

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

MA651 Topology. Lecture 4. Topological spaces 2

Constraint Acquisition

Discrete mathematics , Fall Instructor: prof. János Pach

Integer Programming Theory

Chordal graphs MPRI

COLORING EDGES AND VERTICES OF GRAPHS WITHOUT SHORT OR LONG CYCLES

Chordal Graphs: Theory and Algorithms

Vertex 3-colorability of claw-free graphs

6. Lecture notes on matroid intersection

A CSP Search Algorithm with Reduced Branching Factor

The Structure of Bull-Free Perfect Graphs

Bound Consistency for Binary Length-Lex Set Constraints

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Joint Entity Resolution

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Propagate the Right Thing: How Preferences Can Speed-Up Constraint Solving

Solution for Homework set 3

arxiv:submit/ [math.co] 9 May 2011

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

Designing Networks Incrementally

A General Greedy Approximation Algorithm with Applications

Nim-Regularity of Graphs

Posets, graphs and algebras: a case study for the fine-grained complexity of CSP s

A GRAPH FROM THE VIEWPOINT OF ALGEBRAIC TOPOLOGY

D2.P2: A Query Planner Based on Quantitative and Structural Information. Francesco Scarcello Alfredo Mazzitelli Università della Calabria

Combining Tree Partitioning, Precedence, and Incomparability Constraints

Foundations of Artificial Intelligence

Characterization of Super Strongly Perfect Graphs in Chordal and Strongly Chordal Graphs

Disjoint Support Decompositions

Transcription:

A Comparison of Structural CSP Decomposition Methods Georg Gottlob Institut für Informationssysteme, Technische Universität Wien, A-1040 Vienna, Austria. E-mail: gottlob@dbai.tuwien.ac.at Nicola Leone Department of Mathematics, University of Calabria, I-87036 Rende (CS), Italy. E-mail: leone@unical.at Francesco Scarcello Dipartimento di Elettronica, Informatica e Sistemistica, University of Calabria, I-87036 Rende (CS), Italy. E-mail: scarcello@deis.unical.it Abstract We compare tractable classes of constraint satisfaction problems (CSPs). We first give a uniform presentation of the major structural CSP decomposition methods. We then introduce a new class of tractable CSPs based on the concept of hypertree decomposition recently developed in Database Theory, and analyze the cost of solving CSPs having bounded hypertree-width. We provide a framework for comparing parametric decomposition-based methods according to tractability criteria and compare the most relevant methods. We show that the method of hypertree decomposition dominates the others in the case of general CSPs (i.e., CSPs of unbounded arity). We also make comparisons for the restricted case of binary CSPs. Finally, we consider the application of decomposition methods to the dual graph of a hypergraph. In fact, this technique is often used to exploit binary decomposition methods for nonbinary CSPs. However, even in this case, the hypertree-decomposition method turns out to be the most general method. Key words: Constraint satisfaction, decomposition methods, hypergraphs, tractable cases, degree of cyclicity, treewidth, hypertree width, tree-clustering, cycle cutsets, biconnected components. Part of this work has been published in preliminary form in the proceedings of the Sixteenth International Joint Conference on Artificial Intelligence (IJCAI 99), Stockholm, 1999. Please, address correspondence to Francesco Scarcello. Preprint submitted to Elsevier Preprint 26th October 2000

1 Introduction and Summary of Results The efficient solution of Constraint Satisfaction Problems (CSPs) has been for many years an important goal of AI research. Constraint satisfaction is a central issue of problem solving and has an impressive spectrum of applications [23]. A constraint Ë Ê µ consists of a constraint scope Ë, i.e., a list of variables and an associated constraint relation Ö containing the legal combinations of values. A CSP consists of a set Ë ½ Ö ½ µ Ë ¾ Ö ¾ µ Ë Õ Ö Õ µ of constraints whose variables may overlap (for a precise definition, see Section 2). A solution to a CSP consists a of an assignment of values to all variables such that all constraints are simultaneously satisfied. By solving a CSP we mean detemining whether the problem has a solution at all (i.e., checking for constraint satisfiability), and, if so, compute one solution. Constraint satisfiability is equivalent to various database problems [4,18,7,21], e.g., to the problem of conjunctive query containment [21], or to the problem of evaluating Boolean conjunctive queries over a relational database [22] (for a discussion of this and other equivalent problems, see [15]). Actually, evaluating Boolean conjunctive queries, and deciding constraint satisfaction can be also recast as the same fundamental algebraic problem of deciding whether, given two finite relational structures and, there exists a homomorphism [21]. Constraint satisfiability in its general form is well-known to be NP-hard. Much effort has been spent by both the AI and database communities to identify tractable classes of CSPs. Both communities have obtained deep and useful results in this direction. The various successful approaches to obtain tractable CSP classes can be divided into two main groups [23]: Tractability due to restricted structure. This includes all tractable classes of CSPs that are identified solely on the base of the structure of the constraint scopes Ë ½ Ë Õ, independently of the actual constraint relations Ö ½ Ö Õ. Tractability due to restricted constraint relations. This includes all classes that are tractable due to particular properties of the constraint relations Ö ½ Ö Õ. This paper deals with tractability due to restricted structure. There are several papers proposing polynomially tractable classes of constraints based on different structural properties of the constraint scopes. Usually, these properties can be formalized as graph-theoretic properties of the constraint graph in case of binary constraints, or of the constraint hypergraph in the general case. The constraint hypergraph of a CSP is the hypergraph whose vertices are the variables of the CSP and whose hyperedges are the sets of all those variables which occur together in a constraint scope. It is well known that CSPs with acyclic constraint hypergraphs are polynomially solvable [7]. The known structural properties that lead to tractable CSP classes are 2

all (explicitly or implicitly) based on some generalization of acyclicity. In particular, each method defines some concept of width which can be interpreted as a measure of cyclicity of the underlying constraint (hyper)graph such that, for each fixed width, all CSPs of width bounded by are solvable in polynomial time. There is a plethora of proposed methods based on various different measures of cyclicity, but little was known so far on the relative strength of the different methods. A comparison of the main methods is called for. In this paper we establish a framework for uniformly defining and comparing structural CSP decomposition methods. Within this framework we compare the main methods that have been published so far. In particular, we deal with the following methods (which are reviewed in detail in Section 4): Cycle Cutset [7], Tree Clustering [9], Treewidth [24], Hinge Decomposition [18,19], Hinge Decomposition with Tree Clustering [18], Cycle Hypercutset, and Hypertree Decomposition [16]. We first point out that every considered CSP-decomposition method gives rise to an infinite hierarchy of CSP classes: ½µ ¾µ µ such that the CSPs of each class µ are solvable in time bounded by a polynomial. In particular, for each CSP belonging to class µ there exists a decomposition of width, i.e., a data structure witnessing that can be transformed in polynomial time into an equivalent acyclic CSP. For each CSP-decomposition method, the class µ is a tractable class of CSPs because the following important tasks are tractable: (1) Checking membership of a CSP in µ, and computing a corresponding CSP decomposition for. (2) Solving the CSP. In turn, this task usually consists of the following two subtasks: Transforming C in polynomial time into an equivalent acyclic CSP ¼, and solving ¼ in polynomial time by using well-known algorithms. In this paper we compare only those methods that are tractable in the above sense. In fact, there are methods for solving CSPs, reported in the literature, for which only one of the two tasks (1) and (2) above is tractable, while the other one is NP-hard. For instance, task (1) is NP-complete for the method of bounded query decompositions defined by Chekuri and Rajaraman [6] (see [16] for an NP-completeness proof), while task (2) is intractable for an early method proposed by Freuder [10,11] (see Section 4 for an NP-completeness proof). For a pair of decomposition methods ½ and ¾, we define the following comparison criteria: 3

Generalization. ¾ generalizes ½ if there exists a constant Æ such that, for each level, ½ µ ¾ Ƶ holds. In practical terms, this means that whenever a class of constraints is tractable according to method ½, it is also tractable according to ¾. Moreover, the worst case runtime upper bound guaranteed by method ¾ is polynomially bounded by the worst case upper bound guaranteed by method ½ ; more precisely, the overhead of ¾ with respect to ½ is at most Ò Æ, where Ò is the size of the input CSP. Note that for all pairs of methods compared in this paper, Æ is at most ½. This means that there is no significant loss of efficiency when replacing method ½ with the more general method ¾. Beating. ¾ beats ½ if there exists an integer such that ¾ µ is not contained in class ½ ѵ for any Ñ. Intuitively, this means that some classes of problems are tractable according to ¾ but not according to ½. For such classes, using ¾ is thus better than using ½. Strong generalization. ¾ strongly generalizes ½ if ¾ generalizes ½ and ¾ beats ½. This means that ¾ is really the more powerful method, given that, whenever ½ guarantees polynomial runtime for constraint solving, then also ¾ guarantees tractable constraint solving, but there are classes of constraints that can be solved in polynomial time by using ¾ but are not tractable according to ½. Equivalence. ½ and ¾ are equivalent if ½ generalizes ¾ and ¾ generalizes ½. Intuitively, this means that the methods are polynomial on the same classes of CSPs and do not differ significantly from each other. In this paper we completely classify all above-mentioned decomposition methods according to these criteria. The result of the classification is given in Figure 1. This figure, in addition mentions another method ( ) which is known to be equivalent to the tree-clustering method [9]. An arrow from a method ½ to a method ¾ in Figure 1 indicates that ¾ is strongly more general than ½. Since this relationship is transitive, also a directed path between two methods indicates the same relationship. The picture is complete in the sense that there is a directed path from method ½ to method ¾ if and only if ¾ strongly generalizes ½. On the other hand, whenever two methods are not related by a directed path, then they are incomparable with respect to the generalization relation, and, moreover, each of the two methods beats the other. Figure 1 shows that the method of Hypertree Decompositions dominates all other methods, as it is strongly more general than the other decomposition methods. This method was originally introduced in the database field for identifying a large class of tractable conjunctive queries [16]. In this paper we adapt this notion to the setting of constraints and we show that constraints of bounded hypertree-width are polynomially solvable, providing a precise complexity analysis. In particular, we show that CSPs of hypertree width can be solved in time Ç Ò ½ ÐÓ Òµ. 4

Hypertree Decomposition Hinge Decomposition + Tree Clustering Cycle Hypercutset Hinge Decomposition Tree Clustering Û treewidth Biconnected Components Cycle Cutset Figure 1. Constraint Tractability Hierarchy Hypertree width is a measure of cyclicity specifically designed for hypergraphs. It is interesting to see how the situation changes in the special case of graphs, i.e., of binary CSPs. To answer this question, we have compared all considered method in the binary case (in Section 8; see Figure 25). Again, it turns out that the method of Hypertree Decomposition dominates the others, but this time in a slightly weaker sense to be explained in Section 8. It was recently asked ½ whether the method of Hypertree Decompositions can be explained in terms of simpler and well-known graph cyclicity measures. To every hypergraph À one defines the dual graph of À by taking as vertices the hyperedges of À and by connecting two vertices by an edge if their corresponding hyperedges intersect. The question arose whether the hypertree width of a hypergraph coincides with the treewidth or TCLUSTER width of the dual graph of À (See Section 9 for definitions). We study this interesting question in Section 9 and give a negative answer. More generally, we show that the method of hypertree decompositions strongly generalizes all relevant binary methods based on the dual graph of a given hypergraph. This paper is organized as follows. Section 2 contains preliminaries on CSPs. In Section 3 we discuss tractability of CSPs due to restricted structure. In Section 4 we review well-known CSP decomposition methods. In Section 5 we describe the new method of hypertree decompositions and analyze the cost of solving CSPs having bounded hypertree-width. In Section 6 we explain our comparison criteria and in Section 7 we present the comparison results for general CSPs. The case of binary CSPs is briefly discussed in Section 8. In Section 9 we consider the application of binary methods to the dual graph of a hypergraph. Finally, in Section 10, we draw our conclusions. ½ Rina Dechter, personal communication at IJCAI 99. 5

2 Constraint Satisfaction Problems An instance of a constraint satisfaction problem (CSP) (also constraint network) is a triple Á Î Ö Í µ, where Î Ö is a finite set of variables, Í is a finite domain of values, and ½ ¾ Õ is a finite set of constraints. Each constraint is a pair Ë Ö µ, where Ë is a list of variables of length Ñ called the constraint scope, and Ö is an Ñ -ary relation over Í, called the constraint relation. (The tuples of Ö indicate the allowed combinations of simultaneous values for the variables Ë ). A solution to a CSP instance is a substitution Î Ö Í, such that for each ½ Õ, Ë ¾ Ö. The problem of deciding whether a CSP instance has any solution is called constraint satisfiability (CS). (This definition is taken almost verbatim from [20].) Many well-known problems in Computer Science and Mathematics can be formulated as CSPs. Example 1 The famous graph three-colorability (3COL) problem, i.e., deciding whether the vertices of a graph Î ÖØ µ can be colored by three colors (say: red, green, blue) such that no edge links two vertices having the same color, is formulated as follows as a CSP. The set Î Ö contains a variable Ú for each vertex Ú ¾ Î ÖØ. For each edge Ú Û ¾, where Ú Û according to some ordering on Vertices, the set contains a constraint Ë Ö µ, where Ë Ú Û µ and Ö is the relation Ö consisting of all pairs of different colors, i.e., Ö Ö Ö Ò, Ö ÐÙ, Ö Ò Ö, Ö Ò ÐÙ, ÐÙ Ö, ÐÙ Ö Ò. For instance, the set of constraints for the graph ½ in Figure 2 is the following µ Ö µ, µ Ö µ, µ Ö µ, µ Ö µ,, Àµ Ö µ. a b c g h d e f Figure 2. The graph ½ Example 2 Figure 3 shows a combinatorial crossword puzzle, which is a typical CSP [7,23]. A set of legal words is associated to each horizontal or vertical array of white boxes delimited by black boxes. A solution to the puzzle is an assignment of a letter to each white box such that to each white array is assigned a word from its set of legal words. This problem is represented as follows. There is a variable for each white box, 6

and a constraint for each array of white boxes. (For simplicity, we just write the index for variable.) The scope of is the list of variables corresponding to the white boxes of the sequence ; the relation of contains the legal words for. For the example in Figure 3, we have ½À ½ ¾ µ Ö ½À µ, À ½¼µ Ö À µ, ½½À ½½ ½¾ ½ µ Ö ½½À µ, ¾¼À ¾¼ ¾½ ¾¾ ¾ ¾ ¾ ¾ µ Ö ¾¼À µ, ½Î ½ ½½ ½ ¾¼µ Ö ½Î µ, Î ½ ½ ¾ µ Ö Î µ, Î ½¼ ½ ½ ¾ µ Ö Î µ, ½ Î ½ ½ ¾¾µ Ö ½ Î µ. Subscripts À and Î stand for Horizontal and Vertical, respectively, resembling the usual naming of definitions in the crossword puzzles. A possible instance for the relation Ö ½À is Ó Ù Ó Ò Ð Ó. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Figure 3. A crossword puzzle It is well-known and easy to see that Constraint Satisfiability is an NP-complete problem. Membership in NP is obvious. NP-hardness follows, e.g., immediately from the NP hardness of 3COL [13]. 3 Tractable classes of CSPs Much effort has been spent by both the AI and database communities to indentify tractable classes of CSPs. Both communities have obtained deep and useful results in this direction. The various successful approaches to obtain tractable CSP classes can be divided into two main groups [23]: ½ Tractability due to restricted structure. This includes all tractable classes of CSPs that are identified solely on the base of the structure of the constraint scopes Ë ½ Ë Õ, independently of the actual constraint relations Ö ½ Ö Õ. ¾ Tractability due to restricted constraints. This includes all classes that are tractable due to particular properties of the constraint relations Ö ½ Ö Õ. The present paper deals with tractability due to restricted structure. The structure of a CSP is best represented by its associated hypergraph and by 7

the corresponding primal graph, defined as follows. To any CSP instance Á Î Ö Í µ, we associate a hypergraph À Á Î Àµ, where Î Î Ö, and À Ú Ö Ëµ Ë Öµ ¾, where Ú Ö Ëµ denotes the set of variables in the scope Ë of the constraint. Figure 4 shows the hypergraph À Ô associated to the crossword puzzle of Example 2. 1H 1V 1 2 3 4 5 6 8H 7 8 9 10 11H 5V 11 12 13 14 15 16 20 21 17 22 13V 23 18 24 25 19 26 6V 20H Figure 4. Hypergraph À Ô of the crossword puzzle in Example 2 Since in this paper we always deal with hypergraphs corresponding to CSPs instances, the vertices of any hypergraph À Î Àµ can be viewed as the variables of some constraint satisfaction problem. Thus, we will often use the term variable as a synonym for vertex, when referring to elements of Î. Moreover, for the hypergraph À Î Àµ, Ú Ö Àµ and Àµ denote the sets Î and À, respectively. Let À Á Î Àµ be the constraint hypergraph of a CSP instance Á. The primal graph of Á is a graph Î µ, having the same set of variables (vertices) as À Á and an edge connecting any pair of variables ¾ Î such that for some ¾ À. Note that if all constraints of a CSP are binary, then its associated hypergraph is identical to its primal graph. The most basic and most fundamental structural property considered in the context of CSPs (and conjunctive database queries) is acyclicity. It was recognized independently in AI and in database theory that acyclic CSPs are polynomially solvable. A CSP Á is acyclic if its primal graph is chordal (i.e., any cycle of length greater than 3 has a chord) and the set of its maximal cliques coincide with À Á µ [2]. A join tree ÂÌ Àµ for a hypergraph À is a tree whose vertices are the edges of À such that, whenever the same variable ¾ Î occurs in two edges ½ and ¾ of À, then ½ and ¾ are connected in ÂÌ Àµ, and occurs in each vertex on the unique path linking ½ and ¾ in ÂÌ Àµ. In other words, the set of vertices in which occurs induces a (connected) subtree of ÂÌ Àµ. We will refer to this condition as 8

the Connectedness Condition of join trees. Acyclic hypergraphs can be characterized in terms of join trees: A hypergraph À is acyclic iff it has a join tree [3,2,22]. There exist various equivalent characterizations of acyclic hypergraphs [2,14,22]. Checking the satisfiability of acyclic CSPs (or, equivalently, evaluating acyclic conjunctive queries) is not only tractable but also highly parallelizable. In fact, as shown in [15], this problem is complete for the complexity class LOGCFL, a very low class contained in the parallel classes AC ½ and NC ¾. Many CSPs arising in practice are not acyclic but are in some sense or another close to acyclic CSPs. In fact, the hypergraphs associated with many naturally arising CSPs contain either few cycles or small cycles, or can be transformed to acyclic CSPs by simple operations (such as, e.g., lumping together small groups of vertices). Consequently, CSP research in AI and in database theory concentrated on identifying, defining, and studying suitable classes of nearly acyclic CSPs, or, equivalently, decomposition methods, i.e., techniques for decomposing cyclic CSPs into acyclic CSPs [23,7]. 4 Decomposition Methods In order to study and compare various decomposition methods, we find it useful to introduce a general formal framework for this notion. Let À be a hypergraph. For any set of edges À ¼ Àµ, let Ú Ö À ¼ µ Ë ¾À. Without loss of generality, we assume that Ú Ö À µ Ú Ö Àµ, i.e., every ¼ variable in Ú Ö Àµ occurs in at least one edge of À, and hence, any hypergraph can be simply represented by the set of its edges. Moreover, we assume without loss of generality that all hypergraphs under consideration are both connected, i.e., their primal graph consists of a single connected component, and reduced, i.e., no hyperedge is contained in any other hyperedge. All our definitions and results easily extend to general hypergraphs. Let ÀË be the set of all (reduced and connected) hypergraphs. A decomposition method (short: DM) associates to any hypergraph À ¾ ÀË a parameter - width(à), called the width of À. The decomposition method ensures that, for fixed, every CSP instance Á whose hypergraph À Á has -width is polynomially solvable, i.e., it is solvable in Ô Á µ Ç Á Ç ½µ µ time, where Á denotes the size of Á. For any CSP instance Á, the size of Á is defined in the standard way, i.e., as the number of bits needed for encoding Á by listing, for each constraint in Á, its constraint scope and all tuples occurring in its constraint relation. 9

For any ¼, the -tractable class µ of is defined by µ À -width Àµ Thus, µ collects the set of CSP instances which, for fixed, are polynomially solvable by using the strategy. Typically, the polynomial Ô Á µ depends on the parameter. In particular, for each, there exists a function such that, for each, each instance Á ¾ µ can be transformed in time Ç Á Ç µµ µ into an equivalent acyclic CSP instance. (It follows that all problems in µ are polynomially solvable.) Every DM is complete with respect to ÀË, i.e., ÀË Ë ½ µ. Note that, by our definitions, it holds that -width Àµ Ñ Ò À ¾ µ. All tractable classes based on restricted structure that we have studied in the literature fit into this framework. We next describe how the notion of width is defined in the decomposition methods we shall compare in this paper. Detailed descriptions of these methods can be found in the corresponding reference (see below) and in many surveys on this subject, e.g., [23,7]. 4.1 Biconnected Components (short: BICOMP) [11] Let Î µ be a graph. A vertex Ô ¾ Î is a separating vertex for if, by removing Ô from, the number of connected components of increases. A biconnected component of is a maximal set of vertices Î such that the subgraph of induced by is connected and remains connected after any one-vertex removal, i.e., has no separating vertices. It is well known that, from any graph, we can compute in linear time a vertexlabeled tree Ì, where the labeling function is a bijective function that associates to each vertex of the tree Ì a set of vertices Ë of, such that Ë is either a biconnected component of, or a singleton containing a separating vertex for. There is an edge Ô Õ in the tree Ì, if Ôµ is a biconnected component of and Õµ contains a separating vertex for belonging to the component Ôµ, i.e., Õµ Ôµ, holds. We say that Ì is the Á ÇÅÈ decomposition of. For a hypergraph À, the Á ÇÅÈ decomposition of À is the Á ÇÅÈ decomposition of its primal graph, and the biconnected width of À, denoted by Á ÇÅÈ-width Àµ, is the maximum number of vertices over the biconnected components of the primal graph of À. Example 3 Figure 5.a shows a hypergraph À and Figure 5.b its primal graph. The vertices, and are the separating vertices of this primal graph. Note that 10

the maximum number of vertices over its biconnected components is, and thus Á ÇÅÈ-width Àµ. Figure 6 shows the Á ÇÅÈ decomposition of À. L F L H M H I G M I G F A B C B C P N O D E A D E Q P (a) Q N (b) O Figure 5. (a) The hypergraph À, and (b) its primal graph {G, H, I} {G} {G, L, M} {C, G, F} {A, B, C} {C} {C, D, E} {E} {D} {E, P, Q} {D, N, O} Figure 6. The Á ÇÅÈ decomposition of the hypergraph À in Example 3 4.2 Tree Clustering (short: TCLUSTER) [9] The tree clustering method is based on a triangulation algorithm which transforms the primal graph Î µ of any CSP instance Á into a chordal graph ¼. The acyclic hypergraph À ¼ µ having the same set of vertices as ¼ and the maximal cliques of ¼ as its hyperedges is a Ì ÄÍËÌ Ê decomposition of À Á. Intuitively, the hyperedges of À ¼ µ are used to build the constraints of an acyclic CSP Á ¼ equivalent to Á. The width of the Ì ÄÍËÌ Ê decomposition À ¼ µ is the maximum cardinality of its hyperedges. The tree-clustering width (short: Ì ÄÍËÌ Ê width) of À Á is ½ if À Á is an acyclic hypergraph; otherwise, it is equal to the minimum width over the Ì ÄÍËÌ Ê decompositions of À Á. Example 4 Consider the hypergraph À Ø shown in Figure 7.a. Figure 7.b shows its primal graph. 11

½ ½ ¾ ¾ (a) (b) Figure 7. (a) The hypergraph À Ø, and (b) its primal graph This graph can be triangulated as shown in Figure 8.a. If we associate a hyperedge to each maximal clique of this triangulated graph, we get the acyclic hypergraph shown in Figure 8.b. This acyclic hypergraph is a Ì ÄÍËÌ Ê decomposition of À Ø of width. Moreover, it is easy to see that there is no Ì ÄÍËÌ Ê decomposition for À Ø having a smaller width, and hence the Ì ÄÍËÌ Ê width of À Ø is. ½ ½ ¾ ¾ (a) Figure 8. (a) A triangulation of the primal graph of À Ø, and (b) a Ì ÄÍËÌ Ê decomposition of À Ø (b) 4.3 Treewidth (TREEWIDTH) [24] A tree decomposition of a graph Î µ is a pair Ì, where Ì Æ µ is a tree, and is a labeling function associating to each vertex Ô ¾ Æ a set of vertices Ôµ Î, such that the following conditions are satisfied: (1) for each vertex of, there exists Ô ¾ Æ such that ¾ Ôµ; (2) for each edge ¾, there exists Ô ¾ Æ such that Ôµ; (3) for each vertex of, the set Ô ¾ Æ ¾ Ôµ induces a (connected) subtree of Ì. The width of the tree decomposition Ì is Ñ Ü Ô¾Æ Ôµ ½. The treewidth of is the minimum width over all its tree decompositions. The TREEWIDTH of a hypergraph À is ½ if À is an acyclic hypergraph; otherwise, it is equal to the treewidth of its primal graph. As pointed out below, TREEWIDTH and TCLUSTER 12

are two equivalent methods. Example 5 Consider again the hypergraph À Ø in Example 4. Figure 9 show a tree decomposition of À Ø having width ¾. It follows that the treewidth of À Ø is ¾ as only hypergraphs having acyclic primal graphs have treewidth 1. ½ ½ ¾ ½ Figure 9. A tree decomposition of hypergraph À Ø in Example 4 4.4 Hinge Decompositions (short: HINGE) [18,19] Let À be a hypergraph, À Àµ, and Àµ À. Then is called connected with respect to H if, for any two edges ¾, there exists a sequence ½ Ò of edges in such that µ ½ ; µ for ½ Ò ½, ½ is not contained in Ë ¾À ; and µ Ò. The maximal connected subsets of Àµ À with respect to À are called the connected components of À with respect to À. It is easy to see that the connected components of À with respect to À form a partition of Àµ À. Let À ¾ ÀË and let À be either Àµ or a proper subset of Àµ containing at least two edges. Let ½ Ñ be the connected components of À with respect to À. Then, À is a hinge if, for ½ Ñ, there exists an edge ¾ À such that Ú Ö µµ Ú Ö À µµ. A hinge is minimal if it does not contain any other hinge. A hinge decomposition of À is a tree Ì such that all the following conditions hold: (1) the vertices of Ì are minimal hinges of À; (2) each edge in Àµ is contained in at least one vertex of Ì ; (3) two adjacent vertices and of Ì share precisely one edge Ä ¾ Àµ; moreover, Ä consists exactly of the variables shared by and (i.e., Ä Ú Ö µ Ú Ö µ); (4) the variables of À shared by two vertices of Ì are entirely contained within each vertex on their connecting path in Ì. It was shown in [19] that, for any CSP instance Á, the cardinality of the largest vertex of any hinge decomposition of À Á is an invariant of À Á, and is equal to the cardinality of the largest minimal hinge of À Á. This number is called the degree of cyclicity of À Á. We will also refer to it as the ÀÁÆ width of À Á. 13

s 1 s 2 s 3 s 5 X 1 X 4 X 7 s 6 X10 X11 s 9 X 2 X 5 X 8 X 3 X 6 X 9 s 4 (a) s s 7 8 ½ ¾ ¾ (b) Figure 10. (a) Hypergraph À, and (b) a hinge-tree decomposition of À Example 6 Consider a CSP instance Á having the following constraint scopes: ½ ½ ½¼ ½½ µ ¾ ½ ¾ µ ½ µ µ µ µ µ µ ¾ ½¼ ½½ µ Figure 10 shows the corresponding hypergraph À, which is clearly cyclic. The minimal hinges of À are À ½ ½ ¾, À ¾ ¾, À, À, À, À, and À, where denotes the set of variables occurring in the scope, for ½. Since the cardinality of the largest minimal hinge of À (hinge À ¾ ) is, it follows that the ÀÁÆ width of À is. Figure 10.b shows a ÀÁÆ decomposition of À. 4.5 Hinge Decomposition + Tree Clustering (short: HINGE Ì ÄÍËÌ Ê ) [18] It has been observed [18] that the minimal hinges of a hypergraph can be further decomposed by means of the triangulation technique of the above-described tree-clustering method. This leads to a new decomposition method, that we call HINGE Ì ÄÍËÌ Ê, which combines ÀÁÆ and Ì ÄÍËÌ Ê and can be formally defined as follows. Let Ì Æ µ be a hinge tree of a hypergraph À. For any hinge À ¾ Æ, let Û Àµ be the minimum of the cardinality of À and the Ì ÄÍËÌ Ê width of the hypergraph Ú Ö Àµ Àµ. The HINGE Ì ÄÍËÌ Ê width of À with respect to Ì is Ñ Ü À¾Æ Û Àµ. A HINGE Ì ÄÍËÌ Ê decomposition of À with respect to Ì is an acyclic hypergraph À ¼ having the same set of vertices as À, and whose set of edges is obtained from Ì and À as follows. For each hinge À ¾ Æ, if Û Àµ À, then À ¼ contains an edge Ú Ö Àµ; otherwise, À ¼ contains the edges of any Ì ÄÍËÌ Ê decomposition of the (sub)hypergraph Ú Ö Àµ Àµ having width Û Àµ. The HINGE Ì ÄÍËÌ Ê width of À is the minimum HINGE Ì ÄÍËÌ Ê width over all its HINGE Ì ÄÍËÌ Ê decompositions. 14

½¼ ½ ¾ ½½ Figure 11. A HINGE Ì ÄÍËÌ Ê decomposition of hypergraph À in Example 6 Example 7 Consider again the constraint scopes of Example 6 and the hinge-tree decomposition for the hypergraph À shown in Figure 10.b. From this hinge-tree decomposition, we construct a HINGE Ì ÄÍËÌ Ê decomposition À ¼ of À. Consider the sub-hypergraph Ú Ö À ½ µ À ½ µ corresponding to the minimal hinge À ½ occurring in this hinge-tree decomposition. The primal graph of the hypergraph Ú Ö À ½ µ À ½ µ is a clique containing the vertices ½ ¾ ½¼, and ½½, thus it is easy to see that the Ì ÄÍËÌ Ê width of this hypergraph is. However, the hinge À ½ contains three edges, hence we get Û À ½ µ, and the HINGE Ì ÄÍËÌ Ê decomposition À ¼ contains the edge ½ ¾ ½¼ ½½ with all the variables occurring in À ½. A different situation concerns the sub-hypergraph Ú Ö À ¾ µ À ¾ µ corresponding to the minimal hinge À ¾. This hypergraph is identical to hypergraph À Ø in Example 4. We observed that À Ø has Ì ÄÍËÌ Ê width, which is smaller than À ¾, and hence Û À ¾ µ holds. This means that, in this case, it is convenient to further decompose Ú Ö À ¾ µ À ¾ µ using the Ì ÄÍËÌ Ê decomposition method, and the HINGE Ì ÄÍËÌ Ê decomposition À ¼ contains all the edges belonging to the Ì ÄÍËÌ Ê decomposition of À Ø Ú Ö À ¾ µ À ¾ µ shown in Figure 7. Similarly, for ¾, the sub-hypergraphs Ú Ö À µ À µ corresponding to the other hinges occurring in the hinge-tree decomposition at hand are acyclic hypergraphs. Therefore, Û À µ ½ holds, because the Ì ÄÍËÌ Ê width of acyclic hypergraphs is ½. The resulting HINGE Ì ÄÍËÌ Ê decomposition À ¼ of À is the acyclic hypergraph shown in Figure 11. The thickest edges in this figure come from the Ì ÄÍËÌ Ê decomposition of Ú Ö À ¾ µ À ¾ µ. Recall that both Û À ½ µ and Û À ¾ µ are, which is the maximum value over the hinges occurring in the given ÀÁÆ decompo- 15

sition of À. Thus, the width of À ¼ is, and it is easy to verify that there is no other HINGE Ì ÄÍËÌ Ê decomposition having smaller width. It follows that the HINGE Ì ÄÍËÌ Ê width of À is. 4.6 Cycle Cutset (short: CUTSET) [7] A cycle cutset of a hypergraph À is a set Ë Ú Ö Àµ such that the subgraph of the primal graph of À (vertex-)induced by Ú Ö Àµ Ë is acyclic. That is, after deleting the vertices in Ë, the primal graph of À becomes acyclic. The ÍÌË Ì width of À is ½ if À is acyclic; otherwise, it is the minimum cardinality over all its possible cycle cutsets. Example 8 The hypergraph À shown in Figure 5.a has ÍÌË Ì width. Indeed, is a cycle cutset of this hypergraph, and any smaller set of vertices does not allow to break all the cycles in its primal graph (see Figure 5.b). As another example, consider the hypergraph À Ø shown in Figure 7. The ÍÌË Ì width of À Ø is ¾, because there is no cycle cutset of cardinality ½, while there are cycle cutsets of cardinality ¾, e.g., the set ½. 4.7 Cycle Hypercutset (short: HYPERCUTSET) This is a simple modification of the CUTSET method where the cutset is composed of (hyper)edges rather than vertices of the given hypergraph. A cycle hypercutset of a hypergraph À is a set À Àµ such that the subhypergraph of À induced by Ú Ö Àµ Ú Ö Àµ is acyclic. The À È Ê ÍÌË Ì width of À is ½ if À is acyclic; otherwise, it is the minimum cardinality over all its possible cycle hypercutsets. Example 9 The hypergraph À shown in Figure 5.a has À È Ê ÍÌË Ì width ¾. Indeed, the set containing the two edges and is a hypercutset of this hypergraph, as deleting these edges it becomes acyclic. Moreover, by deleting any single edge, we cannot achieve acyclicity. Instead, the hypergraph À shown in Figure 10 has À È Ê ÍÌË Ì width ½. Indeed, e.g., by just deleting from À the edge we get an acyclic hypergraph. 4.8 Solving CSPs using decomposition methods For each of the above decomposition methods, it was shown (or it is easy to see) that, for any fixed, given a CSP instance Á, deciding whether a hypergraph À Á has -width À Á µ at most is feasible in polynomial time and that solving CSPs 16

whose associated hypergraph is of width at most can be done in polynomial time. In particular, consists of two phases. Given a CSP instance Á, (1) the ( -bounded) width Û of À Á along with a corresponding decomposition is computed; (2) exploiting this decomposition, Á is then solved in time Ç Ò Û ½ ÐÓ Òµ, where Ò is the size of Á plus the size of the given decomposition (for most methods this phase consists of the solution of an acyclic CSP instance equivalent to Á). Actually, for these methods it is always possible to give the decompositions in suitable forms without redundancies. Thus, the cost above reduces to Ç Á Û ½ ÐÓ Á µ, i.e., it depends only on the CSP instance, and does not depend on the size of the decomposition. For a detailed analysis, see Section 5, where we study the complexity of evaluating bounded-width CSPs according to a new decomposition method, based on hypertree decompositions [16]. The cost of the first phase is independent on the constraint relations of Á; in fact, it is Ç À Á ½ ¾ µ, where À Á is the size of the hypergraph À Á, and ½, ¾ are two constants relative to the method (¼ ½ ¾ for the methods above). As usual, the size of hypergraph À Á is defined as the number of bits needed for encoding all the edges of À Á as lists of variables. Clearly, the size of À Á is always smaller than than Á, because the encoding of Á includes the encoding of its constraint relations, too. Observe also that computing the -width Û of a hypergraph in general (i.e., without the constant bound Û ) is NP-hard for most methods, while it is feasible in polynomial time for ÀÁÆ, and even in linear time for Á ÇÅÈ. Remark 10 The above complexity bounds, given as functions of the total size of the CSP instance, are appropriate for all considered decomposition methods for general CSP instances. Of course, if one considers some restricted cases, e.g., CSP instances with a fixed constant domain size, some finer analysis may be useful. In fact, by exploiting additional information, more accurate complexity bounds may be found in order to choose a method that is better tailored for such a special case. 4.9 Freuder width and adaptive width Further interesting methods, that do not explicitly generalize acyclic hypergraphs, are based on a different notion of width, that we call Freuder width [10,11]. If is a total ordering of the vertices of a graph Î µ, then the -width of is defined by Û µ Ñ Ü Ú¾Î Ú Û ¾ s.t. Û Ú. The Freuder width of is the minimum of all -widths over all possible total orderings of Î. For each fixed constant, it can be determined in polynomial time whether a graph is of Freuder width. The graph ½ shown in Figure 2 has Freuder width 3. This width can be obtained taking the ordering. Freuder observed that many naturally arising CSPs have a very low width [10]. He 17

showed that a CSP of width whose relations enjoy the property of ¼ -consistency, where ¼, can be solved in a backtrack-free manner, and thus in polynomial time [10,11]. Clearly, since the consistency condition on the constraint relations must be satisfied, we cannot define a purely structural decomposition method based on Freuder width. In fact, the following theorem pinpoints that the structural property of bounded Freuder width does not make the CSP problem any easier. Theorem 11 Constraint solvability remains NP-complete even if restricted to CSPs whose primal graph has Freuder width bounded by 4. PROOF. 3COL remains NP-complete even for graphs of degree 4 (cf. [13]). Such graphs, however, have width at most. By the encoding of 3COL as a CSP, as given in Section 2, the theorem follows. ¾ One can try to enforce a suitable level of consistency on the constraint relations of a given CSP instance. However, the algorithms used to increase the level of consistency in the data also increase the Freuder width of the instance [25,8]. Of course, one can think of devising a more powerful procedure to find an equivalent CSP instance whose Freuder width stays below a fixed bound. However, from the above theorem, if P NP, such a procedure cannot run in polynomial time. Dechter and Pearl subsequently introduced the notion of induced width Û [8], which is roughly the smallest Freuder width of any graph ¼ obtained by triangulation methods from the primal graph of a CSP such that ¼ ensures ½- consistency. Graphs having induced width at most can be also characterized as partial -trees [12] or, equivalently, as graphs having treewidth at most [1]. It follows that, for fixed, checking whether Û is feasible in linear time [5]. If Û is bounded by a constant, a CSP is solvable in polynomial time. The approach to CSPs based on Û is referred to as the Û -Tractability method [7]. Note that this method is implicitly based on hypergraph acyclicity, given that the used triangulation methods enforce chordality of the resulting graph ¼ and thus acyclicity of the corresponding hypergraph. It was noted [9,7] that, for any cyclic CSP instance Á, TCLUSTER width À Á µ Û À Á µ ½. 5 Hypertree Decompositions of CSPs A new class of tractable conjunctive database queries, which generalizes the class of acyclic queries, has recently been identified [16]. This is the class of queries having a bounded-width hypertree decomposition [16]. Deciding whether a given query has this property is feasible in polynomial time and even highly parallelizable. In this section we first adapt the notion of hypertree decomposition, previously 18

defined in the database context, to the general framework of hypergraphs. Then, we show how to employ this notion in order to define a new CSP decomposition method we will refer to as À È ÊÌÊ. A hypertree for a hypergraph À is a triple Ì, where Ì Æ µ is a rooted tree, and and are labeling functions which associate to each vertex Ô ¾ Æ two sets Ôµ Ú Ö Àµ and Ôµ Àµ. If Ì ¼ Æ ¼ ¼ µ is a subtree of Ì, we define Ì Ë ¼ µ ¼ Ú¾Æ Úµ. We denote the set of vertices Æ of Ì by Ú ÖØ Ì µ, and the root of Ì by ÖÓÓØ Ì µ. Moreover, for any Ô ¾ Æ, Ì Ô denotes the subtree of Ì rooted at Ô. Definition 12 A hypertree decomposition of a hypergraph À is a hypertree À Ì for À which satisfies all the following conditions: (1) for each edge ¾ Àµ, there exists Ô ¾ Ú ÖØ Ì µ such that Ú Ö µ Ôµ (we say that Ô covers ); (2) for each variable ¾ Ú Ö Àµ, the set Ô ¾ Ú ÖØ Ì µ ¾ Ôµ induces a (connected) subtree of Ì ; (3) for each Ô ¾ Ú ÖØ Ì µ, Ôµ Ú Ö Ôµµ; (4) for each Ô ¾ Ú ÖØ Ì µ, Ú Ö Ôµµ Ì Ô µ Ôµ. Note that the inclusion in Condition 4 is actually an equality, because Condition 3 implies the reverse inclusion. An edge ¾ Àµ is strongly covered in À if there exists Ô ¾ Ú ÖØ Ì µ such that Ú Ö µ Ôµ and ¾ Ôµ. In this case, we say that Ô strongly covers. A hypertree decomposition À of hypergraph À is a complete decomposition of À if every edge of À is strongly covered in À. The width of a hypertree decomposition Ì is Ñ Ü Ô¾Ú ÖØ Ì µ Ôµ. The HYPERTREE width Û Àµ of À is the minimum width over all its hypertree decompositions. A -width hypertree decomposition of À is optimal if Û Àµ. The acyclic hypergraphs are precisely those hypergraphs having hypertree width one. Indeed, any join tree of an acyclic hypergraph À trivially corresponds to a hypertree decomposition of À of width one. Furthermore, if a hypergraph À ¼ has a hypertree decomposition of width one, then, from this decomposition, we can easily compute a join tree of À ¼, which is therefore acyclic [16]. Remark 13 From any hypertree decomposition À of À, we can easily compute a complete hypertree decomposition of À having the same width. For any missing edge, choose a vertex Õ of Ì such that Ú Ö µ Õµ (such a vertex must exist by Condition 1), and create a new vertex Ô as a child of Õ with Ôµ and Ôµ Ú Ö µ. Assuming the use of suitable data structures, this computation can 19

be done in Ç À À µ time, where À denotes the size of a hypertree decomposition, i.e., the number of bits needed for encoding À (that is, for encoding the rooted tree of À and, for each vertex Ú of this tree, the labelings and for Ú, encoded as a list of variables and a list of edge identifiers, respectively). Intuitively, if À is a cyclic hypergraph, the labeling selects the set of variables to be fixed in order to split the cycles and achieve acyclicity; Ôµ covers the variables of Ôµ by a set of edges. Example 14 Figure 12 shows a hypertree decomposition of width 2 of the hypergraph À Ô of the crossword puzzle in Example 2 (see Figure 4). Each box in this figure represents a vertex Ú of the hypertree decomposition of À Ô. The two sets depicted in the box are the labelings Úµ and Úµ. The hypergraph À Ô is clearly cyclic, therefore Û À Ô µ ½ (as only acyclic hypergraphs have hypertree width 1). Thus, it follows that the À È ÊÌÊ width of À Ô is 2. {1, 2, 3, 4, 5, 20, 21, 22, 23, 24, 25, 26} {1H, 20H} {1, 7, 11, 16, 20, 22} {1V, 20H} {5, 8, 14, 18, 24, 26} {5V, 20H} {11, 12, 13, 17, 22} {11H, 13V} {8, 9, 10, 6, 15, 19, 26} {8H, 6V} Figure 12. A hypertree decomposition of width 2 of hypergraph À Ô in Example 2 Â ¼ ¼ ¼ ¼ Ë ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ Figure 13. A 2-width hypertree decomposition of À ½ Example 15 Consider the following constraint scopes: Â ¼ ¼ µ Ë ¼ µ Ë ¼ ¼ ¼ µ ¼ µ µ µ ¼ ¼ µ ¼ ¼ µ ¼ ¼ µ Let À ½ be their corresponding hypergraph. Since À ½ is cyclic, Û À ½ µ ½ holds. Figure 13 shows a (complete) hypertree decomposition of À ½ having width 2, hence Û À ½ µ ¾. 20

 ¼ ¼ µ Ë ¼ µ Ë ¼ ¼ ¼ µ µ ¼ µ ¼ ¼ µ ¼ ¼ µ µ µ ¼ ¼ µ ¼ ¼ µ Figure 14. Hyperedge representation of hypertree decomposition À In order to help the intuition of what a hypertree decomposition is, we also present an alternative representation, called hyperedge representation. (Also, atom representation, in the conjunctive-queries framework.) Figure 14 shows the hyperedge representation of the hypertree decomposition À ½ of À ½. Each node Ô in the tree is labeled by a set of hyperedges representing Ôµ; Ôµ is the set of all variables, distinct from, appearing in these hyperedges. Thus, the anonymous variable replaces the variables in Ú Ö Ôµµ Ôµ. Using this representation, we can easily observe an important feature of hypertree decompositions. Once an hyperedge has been covered by some vertex of the decomposition tree, any subset of its variables can be used freely in order to decompose the remaining cycles in the hypergraph. For instance, the variables in the hyperedge corresponding to constraint in À ½ are jointly included only in the root of the decomposition. If we were forced to take all the variables in every vertex where occurs, it would not be possible to find a decomposition of width 2. Indeed, in this case, any choice of two hyperedges per vertex yields a hypertree which violates the connectedness condition for variables (i.e., Condition 2 of Definition 12). Let be a fixed positive integer. We say that a CSP instance Á has -bounded À È ÊÌÊ width if Û À Á µ, where À Á is the hypergraph associated to Á. From the results in [16], it follows that -bounded hypertree width is efficiently decidable, and that a hypertree decomposition of width can be efficiently computed (if any). Example 16 Consider again the CSP instance Á in Example 6. Figure 15 shows the hyperedge representation of a width 2 hypertree decomposition of its hypergraph À. It follows that Û À µ ¾, because À is cyclic. Thus, Á has 2-bounded À È ÊÌÊ width and, more generally, -bounded À È ÊÌÊ width for any integer ½. Let À be a hypergraph, and let Î Ú Ö Àµ be a set of variables and ¾ Ú Ö Àµ. Then is [Î ]-adjacent to if there exists an edge ¾ Àµ such that Î. A [Î ]-path from to is a sequence ¼ of variables such that is [Î ]-adjacent to ½, for each ¾ ¼ -½. A set 21

¾ ½ ¾ µ µ ½ ½ ½¼ ½½ µ ¾ ½¼ ½½ µ ½ µ µ µ µ µ Figure 15. A hypertree decomposition of hypergraph À in Example 6 Ï Ú Ö Àµ of variables is [Î ]-connected if, for all ¾ Ï, there is a [Î ]-path from to. A [Î ]-component is a maximal [Î ]-connected non-empty set of variables Ï Ú Ö Àµ Î. For any [Î ]-component, let µ ¾ Àµ. Let À Ì be a hypertree for À. For any vertex Ú of Ì, we will often use Ú as a synonym of Úµ. In particular, [Ú]-ÓÑÔÓÒ ÒØ denotes [ Úµ]-ÓÑÔÓÒ ÒØ; the term [Ú]-path is a synonym of [ Úµ]-path; and so on. We introduce a normal form for hypertree decompositions. Definition 17 ([16]) A hypertree decomposition À Ì of a hypergraph À is in normal form (NF) if, for each vertex Ö ¾ Ú ÖØ Ì µ, and for each child of Ö, all the following conditions hold: ½ there is (exactly) one [Ö]-ÓÑÔÓÒ ÒØ Ö such that Ì µ Ö µ Öµµ; ¾ µ Ö, where Ö is the [Ö]-component satisfying Condition 1; Ú Ö µµ Öµ µ. Intuitively, each subtree rooted at a child node of some node Ö of a normal form decomposition tree serves to decompose precisely one [Ö]-ÓÑÔÓÒ ÒØ. Proposition 18 ([16]) For each -width hypertree decomposition of a hypergraph À there exists a -width hypertree decomposition of À in normal form. This normal form theorem immediately entails that, for each optimal hypertree decomposition of a hypergraph À, there exists an optimal hypertree decomposition of À in normal form. The fact that no redundancies occur in hypertree decompositions in normal form allows us to give a precise bound on the number of vertices in such hypertree decompositions. Lemma 19 Let À Ì µ be a hypertree decomposition in normal form of a hypergraph À. Moreover, let Ò be the number of vertices of the decomposition tree Ì, and Ñ the number of strongly covered edges of À in À. Then, Ò Ñ holds. PROOF. Let be some vertex in Ì. We say that a variable ¾ µ (respectively, an edge À µµ) is first covered in if ¾ Ú ÖØ Ì µ Ú ÖØ Ì Ô µµ 22

(resp., À Ú ÖØ Ì µ Ú ÖØ Ì Ô µµ); otherwise, (resp., À) is said to be previously covered. By Condition 2 of Definition 17 and by Condition 2 of Def. 12, it follows that, for any vertex Ô of Ì, there exists at least a variable in Ú Ö Àµ which is first covered in Ô. Since ¾ Ôµ, from Condition 3 of Definition 12, it follows that there is an edge À of À such that ¾ À and À ¾ Ôµ. Moreover, from Condition 4 of Definition 12, it follows that every variable belonging to À and not covered in some vertex in Ú ÖØ Ì µ Ú ÖØ Ì Ô µ must be first covered in Ô, and belongs to Ôµ. Moreover, since À is in normal form, it satisfies Condition 3 of Definition 17. (i.e., Ú Ö µµ Öµ µ). It follows that, in fact, any previously-covered variable belonging to À must belong to Ôµ. Indeed, since the variable was not previously covered, the edge À cannot be previously covered, and thus there exists some vertex Ô ¼ in the subtree Ì Ô such that À Ô ¼ µ, in order to fulfill Condition 1 of Definition 12. Assume that the variable ¾ À does not belong to Ôµ. Since À is strongly covered by Ô ¼, ¾ Ô ¼ µ. Moreover, by the choice of, this variable is previously covered with respect to Ô. It follows that violates the connectedness condition, a contradiction. Thus, all the variables in À belong to Ôµ. Recall that À ¾ Ôµ, too. It follows that at least one edge of À is first covered in vertex Ô and strongly covered by Ô, and, in general, that each vertex in Ì first and strongly covers some edge of À. This entails that the cardinality of the set of vertices in the decomposition tree Ì of À is less than or equal to the number Ñ of the strongly covered edges in the normal form hypertree decomposition À of À. ¾ A polynomial time algorithm opt- -decomp which, for a fixed, decides whether a hypergraph has -bounded hypertree width and, in this case, computes an optimal hypertree decomposition in normal form is described in [17]. As for many other decomposition methods, the running time of this algorithm to find the hypergraph decomposition is exponential in the parameter. More precisely, opt- -decomp runs in Ç Ñ ¾ Ú ¾ µ time, where Ñ and Ú are the number of edges and the number of vertices of À, respectively. We next show that any CSP instance Á is efficiently solvable, given a -bounded complete hypertree-decomposition À of À Á. To this end, we define an acyclic CSP instance which is equivalent to Á and whose size is polynomially bounded by the size of Á. For each vertex Ô of the decomposition À, we define a new constraint scope whose associated constraint relation is the projection on Ôµ of the join of the relations in Ôµ. This way, we obtain a join-tree ÂÌ of an acyclic hypergraph À. À corresponds to a new CSP instance Á over a set of constraint relations of size Ç Ò µ, where Ò is the input size (i.e., Ò Á ) and is the width of the hyper- 23

tree decomposition À. By construction, Á is an acyclic CSP, and we can easily show that it is equivalent to the input CSP instance Á. Thus, all the efficient techniques available for acyclic CSP instances [9,7], or for any problem equivalent to CSP [26,21,15], can be employed for the evaluation of Á, and hence of Á. Remark 20 According to our definition, any hypertree is a labeled rooted tree. The rooting is necessary for technical reasons concerning the notion of hypertree decomposition only, but has no impact on the actual evaluation of the given CSP instance. In fact, the above discussion describes how to compute from a hypertree decomposition and a CSP instance Á a join tree ÂÌ of an acyclic instance Á that is equivalent to Á. This construction does not use the fact that the hypertree is rooted. Moreover, note that the acyclic instance Á can be evaluated rooting the join tree ÂÌ at any vertex. The following theorem provides a detailed analysis of the complexity of evaluating a CSP given a hypertree decomposition for it. Theorem 21 Given a CSP Á and a -width hypertree decomposition À ¼ of À Á in normal form, Á is solvable in Ç Á ½ ÐÓ Á µ time. PROOF. Let Á be a CSP instance and À ¼ Ì ¼ ¼ ¼ µ a -width hypertree decomposition of À Á in normal form. We proceed as follows. Step 1 We compute from À ¼ a complete hypertree decomposition À Ì µ of À Á. Step 2 We compute from À and Á an acyclic instance Á equivalent to Á, as described above. Step 3 We evaluate the acyclic instance Á employing any efficient technique for solving acyclic CSPs. Let Ñ be the number of edges of À Á. The following statements hold: Claim 1. The decomposition tree of the complete hypertree decomposition À has at most Ñ vertices. This immediately follows from the construction of À and from Lemma 19, since in Step 1 above we just add to the decomposition tree Ì those edges of À Á that are not strongly covered in À ¼. Claim 2. Step 1 is feasible in Ç À Á ¾ µ. As observed in Remark 13, this computation takes Ç À ¼ À Á µ time. From Lemma 19, it easily follows that À ¼ is Ç À Á µ Ç À Á µ, because the number of vertices in Ì ¼ is at most the number of edges of À Á, and the number of edge-labels of each vertex of Ì ¼ is bounded by the constant. Claim 3. Á Ç Á µ, and computing Á from Á takes time Ç Á µ. Consider a constraint Ë Ö µ in the acyclic instance Á. As described above, the relation Ö is obtained as the natural join of at most relations occurring in the input instance Á. One of these input relations, say Ö, in fact, its constraint scope Ë 24