Query Evaluation via Tree-Decompositions [chapter]

Jörg Flum, Markus Frick, Martin Grohe
2001 Lecture Notes in Computer Science  
A number of efficient methods for evaluating first-order and monadic-second order queries on finite relational structures are based on tree-decompositions of structures or queries. We systematically study these methods. In the first-part of the paper we consider arbitrary formulas on tree-like structures. We generalize a theorem of Courcelle [2] by showing that on structures of bounded tree-width a monadic second-order formula (with free first-and second-order variables) can be evaluated in
more » ... linear in the structure size plus the size of the output. In the second part we study tree-like formulas on arbitrary structures. We generalize the notions of acyclicity and bounded tree-width from conjunctive queries to arbitrary first-order formulas in a straightforward way and analyze the complexity of evaluating formulas of these fragments. Moreover, we show that the acyclic and bounded tree-width fragments have the same expressive power as the well-known guarded fragment and the finite-variable fragments of first-order logic, respectively. This is an abstract of [4]. Tree-Decompositions A hypergraph À is pair´À À µ consisting of a set À of vertices and a set À of subsets of À called hyperedges. A tree-decomposition of a hypergraph À is a paiŕ Ì ´À Ø µ Ø¾Ì µ, where Ì is a tree and´À Ø µ Ø¾Ì a family of subsets of À (called the blocks of the decomposition) such that (1) For every Ú ¾ À, the set Ø ¾ Ì Ú ¾ À Ø is nonempty and connected (i.e. a subtree). (2) For every ¾ À there is a Ø ¾ Ì such that À Ø . The width of a tree-decomposition´Ì ´À Ø µ Ø¾Ì µ is max À Ø Ø ¾ Ì ½. The tree-width tw´Àµ of À is the minimal width of a tree-decomposition of À. A hypergraph À is acyclic if it has a tree-decompositioń Ì ´À Ø µ Ø¾Ì µ where for every Ø ¾ Ì there exists an ¾ À such that À Ø . Part 1: Tree-Like Structures A tree-decomposition of a relational structure is a tree-decomposition of the hypergraph whose vertex set is the universe of and whose hyperedges are all sets ½ Ö such that the tuple´ ½ Ö µ is in some relation of . The tree-width of is defined accordingly. Let ³´ ½ Ð Ü ½ Ü Ñ µ be a formula of monadic second-order logic with free set variables ½ Ð and free element variables Ü ½ Ü Ñ . Then for every structure we let ³´ µ be the set of all tuples´ ½ Ð ½ Ñ µ such that ³´ ½ Ð ½ Ñ µ. Theorem 1. There exists a function AE ¢ AE AE and an algorithm that, given a structure and a formula ³ of monadic second-order logic, computes the set ³´ µ in time ³ tw´ µ ¡ · ³´ µ Here ³ is the length of the formula ³, the cardinality of the universe of the structure , and ³´ µ the size of a reasonable encoding of the set ³´ µ. As applications of this theorem, for instance, we can find all cliques of of a graph of bounded tree-width in time Ç´ · È clique in µ, or we can find all Hamiltonian cycles of in time Ç´ ¡ µ, where is the number of Hamiltonian cycles of . Part 2: Tree-Like Formulas With every first-order formula ³ we associate a hypergraph À ³ whose vertices are the variables of ³ and whose edges are the sets Ü ½ Ü of variables such that ³ contains an atom «´Ü ½ Ü µ. A tree-decomposition of ³ is a tree-decomposition of À ³ , and acyclicity and treewidth are defined with respect to such decompositions. There is a refined notion that sometimes yields better results: A tree-decomposition of ³ is strict if the set of all free variables of ³ is contained in a block of the decomposition. This yields the notions of strict acyclicity and strict tree-width. We start by reviewing (and precisely analyzing) an algorithm due to Yannakakis for evaluating acyclic conjunctive queries. Recall that a conjunctive query is a formula of the form Ý Î Ò ½ « , where all « are atoms. The evaluation problem for a class L of formulas is the problem of computing ³´ µ, given ³ ¾ L and .
doi:10.1007/3-540-44503-x_2 fatcat:ozgbjfyezrdmfmbblvofhfhb2y