Counting Answers to Unions of Conjunctive Queries: Natural Tractability Criteria and Meta-Complexity (2311.10634v2)
Abstract: We study the problem of counting answers to unions of conjunctive queries (UCQs) under structural restrictions on the input query. Concretely, given a class C of UCQs, the problem #UCQ(C) provides as input a UCQ Q in C and a database D and the problem is to compute the number of answers of Q in D. Chen and Mengel [PODS'16] have shown that for any recursively enumerable class C, the problem #UCQ(C) is either fixed-parameter tractable or hard for one of the parameterised complexity classes W[1] or #W[1]. However, their tractability criterion is unwieldy in the sense that, given any concrete class C of UCQs, it is not easy to determine how hard it is to count answers to queries in C. Moreover, given a single specific UCQ Q, it is not easy to determine how hard it is to count answers to Q. In this work, we address the question of finding a natural tractability criterion: The combined conjunctive query of a UCQ $\varphi_1 \vee \dots \vee \varphi_\ell$ is the conjunctive query $\varphi_1 \wedge \dots \wedge \varphi_\ell$. We show that under natural closure properties of C, the problem #UCQ(C) is fixed-parameter tractable if and only if the combined conjunctive queries of UCQs in C, and their contracts, have bounded treewidth. A contract of a conjunctive query is an augmented structure, taking into account how the quantified variables are connected to the free variables. If all variables are free, then a conjunctive query is equal to its contract; in this special case the criterion for fixed-parameter tractability of #UCQ(C) thus simplifies to the combined queries having bounded treewidth. Finally, we give evidence that a closure property on C is necessary for obtaining a natural tractability criterion: We show that even for a single UCQ Q, the meta problem of deciding whether #UCQ({Q}) can be solved in time $O(|D|d)$ is NP-hard for any fixed $d\geq 1$.
- Popular conjectures imply strong lower bounds for dynamic problems. In 55th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 434–443. IEEE Computer Society, 2014.
- Foundations of Databases. Addison-Wesley, 1995.
- When is approximate counting for conjunctive queries tractable? In Samir Khuller and Virginia Vassilevska Williams, editors, STOC ’21: 53rd Annual ACM SIGACT Symposium on Theory of Computing, Virtual Event, Italy, June 21-25, 2021, pages 1015–1027. ACM, 2021.
- Vikraman Arvind. The Weisfeiler-Lehman procedure. Bull. EATCS, 120, 2016.
- On the Weisfeiler-Leman dimension of fractional packing. Inf. Comput., 288:104803, 2022.
- László Babai. Graph isomorphism in quasipolynomial time [extended abstract]. In Daniel Wichs and Yishay Mansour, editors, Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 684–697. ACM, 2016.
- Guillaume Bagan. Algorithmes et complexité des problèmes d’énumération pour l’évaluation de requêtes logiques. (Algorithms and complexity of enumeration problems for the evaluation of logical queries). PhD thesis, University of Caen Normandy, France, 2009.
- On acyclic conjunctive queries and constant delay enumeration. In Jacques Duparc and Thomas A. Henzinger, editors, Computer Science Logic, 21st International Workshop, CSL 2007, 16th Annual Conference of the EACSL, Lausanne, Switzerland, September 11-15, 2007, Proceedings, volume 4646 of Lecture Notes in Computer Science, pages 208–222. Springer, 2007.
- Weisfeiler and Leman go relational. In Bastian Rieck and Razvan Pascanu, editors, Learning on Graphs Conference, LoG 2022, 9-12 December 2022, Virtual Event, volume 198 of Proceedings of Machine Learning Research, page 46. PMLR, 2022.
- Semantic Acyclicity on Graph Databases. SIAM J. Comput., 45(4):1339–1376, 2016.
- Counting subgraphs in degenerate graphs. J. ACM, 69(3):23:1–23:21, 2022.
- Constant delay enumeration for conjunctive queries: a tutorial. ACM SIGLOG News, 7(1):4–33, 2020.
- Answering conjunctive queries under updates. In Emanuel Sallinger, Jan Van den Bussche, and Floris Geerts, editors, Proceedings of the 36th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 2017, Chicago, IL, USA, May 14-19, 2017, pages 303–318. ACM, 2017.
- Answering UCQs under updates and in the presence of integrity constraints. In Benny Kimelfeld and Yael Amsterdamer, editors, 21st International Conference on Database Theory, ICDT 2018, March 26-29, 2018, Vienna, Austria, volume 98 of LIPIcs, pages 8:1–8:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018.
- Constant delay enumeration with fpt-preprocessing for conjunctive queries of bounded submodular width. In Peter Rossmanith, Pinar Heggernes, and Joost-Pieter Katoen, editors, 44th International Symposium on Mathematical Foundations of Computer Science, MFCS 2019, August 26-30, 2019, Aachen, Germany, volume 138 of LIPIcs, pages 58:1–58:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019.
- Hans L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput., 25(6):1305–1317, 1996.
- Johann Brault-Baron. De la pertinence de l’énumération : complexité en logiques propositionnelle et du premier ordre. (The relevance of the list: propositional logic and complexity of the first order). PhD thesis, University of Caen Normandy, France, 2013.
- An optimal lower bound on the number of variables for graph identification. Comb., 12(4):389–410, 1992.
- The complexity of satisfiability of small depth circuits. In Jianer Chen and Fedor V. Fomin, editors, Parameterized and Exact Computation, 4th International Workshop, IWPEC 2009, Copenhagen, Denmark, September 10-11, 2009, Revised Selected Papers, volume 5917 of Lecture Notes in Computer Science, pages 75–85. Springer, 2009.
- Answering (unions of) conjunctive queries using random access and random-order enumeration. ACM Trans. Database Syst., 47(3):9:1–9:49, 2022.
- Optimal Implementation of Conjunctive Queries in Relational Data Bases. In John E. Hopcroft, Emily P. Friedman, and Michael A. Harrison, editors, Proceedings of the 9th Annual ACM Symposium on Theory of Computing, May 4-6, 1977, Boulder, Colorado, USA, pages 77–90. ACM, 1977.
- A trichotomy in the complexity of counting answers to conjunctive queries. In Marcelo Arenas and Martín Ugarte, editors, 18th International Conference on Database Theory, ICDT 2015, March 23-27, 2015, Brussels, Belgium, volume 31 of LIPIcs, pages 110–126. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2015.
- Counting answers to existential positive queries: A complexity classification. In Tova Milo and Wang-Chiew Tan, editors, Proceedings of the 35th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 2016, San Francisco, CA, USA, June 26 - July 01, 2016, pages 315–326. ACM, 2016.
- Tight lower bounds for certain parameterized NP-hard problems. Inf. Comput., 201(2):216–231, 2005.
- Strong computational lower bounds via parameterized complexity. J. Comput. Syst. Sci., 72(8):1346–1367, 2006.
- The exponential time hypothesis and the parameterized clique problem. In Dimitrios M. Thilikos and Gerhard J. Woeginger, editors, Parameterized and Exact Computation - 7th International Symposium, IPEC 2012, Ljubljana, Slovenia, September 12-14, 2012. Proceedings, volume 7535 of Lecture Notes in Computer Science, pages 13–24. Springer, 2012.
- Homomorphisms are a good basis for counting small subgraphs. In Hamed Hatami, Pierre McKenzie, and Valerie King, editors, Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 210–223. ACM, 2017.
- Parameterized Algorithms. Springer, 2015.
- The complexity of counting homomorphisms seen from the other side. Theor. Comput. Sci., 329(1-3):315–323, 2004.
- Lovász meets Weisfeiler and Leman. In Ioannis Chatzigiannakis, Christos Kaklamanis, Dániel Marx, and Donald Sannella, editors, 45th International Colloquium on Automata, Languages, and Programming, ICALP 2018, July 9-13, 2018, Prague, Czech Republic, volume 107 of LIPIcs, pages 40:1–40:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018.
- Counting answers to existential questions. In Christel Baier, Ioannis Chatzigiannakis, Paola Flocchini, and Stefano Leonardi, editors, 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, July 9-12, 2019, Patras, Greece, volume 132 of LIPIcs, pages 113:1–113:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019.
- Structural tractability of counting of solutions to conjunctive queries. In Wang-Chiew Tan, Giovanna Guerrini, Barbara Catania, and Anastasios Gounaris, editors, Joint 2013 EDBT/ICDT Conferences, ICDT ’13 Proceedings, Genoa, Italy, March 18-22, 2013, pages 81–92. ACM, 2013.
- Improved approximation algorithms for minimum weight vertex separators. SIAM J. Comput., 38(2):629–657, 2008.
- Parameterized Complexity Theory. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2006.
- Approximately counting answers to conjunctive queries with disequalities and negations. In Leonid Libkin and Pablo Barceló, editors, PODS ’22: International Conference on Management of Data, Philadelphia, PA, USA, June 12 - 17, 2022, pages 315–324. ACM, 2022.
- Counting small induced subgraphs with hereditary properties. In Stefano Leonardi and Anupam Gupta, editors, STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1543–1551. ACM, 2022.
- Martin Fürer. On the combinatorial power of the weisfeiler-lehman algorithm. In Dimitris Fotakis, Aris Pagourtzis, and Vangelis Th. Paschos, editors, Algorithms and Complexity - 10th International Conference, CIAC 2017, Athens, Greece, May 24-26, 2017, Proceedings, volume 10236 of Lecture Notes in Computer Science, pages 260–271, 2017.
- Treewidth and hypertree width. In Lucas Bordeaux, Youssef Hamadi, and Pushmeet Kohli, editors, Tractability: Practical Approaches to Hard Problems, pages 3–38. Cambridge University Press, 2014.
- Hypertree decomposition and tractable queries. Journal of Computer and System Sciences, 64(3):579–627, 2002.
- Counting solutions to conjunctive queries: structural and hybrid tractability. In Richard Hull and Martin Grohe, editors, Proceedings of the 33rd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS’14, Snowbird, UT, USA, June 22-27, 2014, pages 132–143. ACM, 2014.
- Martin Grohe. The complexity of homomorphism and constraint satisfaction problems seen from the other side. J. ACM, 54(1):1:1–1:24, 2007.
- Constraint solving via fractional edge covers. ACM Transactions on Algorithms, 11(1):4:1–4:20, 2014.
- When is the evaluation of conjunctive queries tractable? In Jeffrey Scott Vitter, Paul G. Spirakis, and Mihalis Yannakakis, editors, Proceedings on 33rd Annual ACM Symposium on Theory of Computing, July 6-8, 2001, Heraklion, Crete, Greece, pages 657–666. ACM, 2001.
- On the complexity of k-SAT. J. Comput. Syst. Sci., 62(2):367–375, 2001.
- Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512–530, 2001.
- Monte-Carlo algorithms for enumeration and reliability problems. In 24th Annual Symposium on Foundations of Computer Science, Tucson, Arizona, USA, 7-9 November 1983, pages 56–64. IEEE Computer Society, 1983.
- The Weisfeiler-Leman dimension of planar graphs is at most 3. J. ACM, 66(6):44:1–44:31, 2019.
- On the expressive power of datalog: Tools and a case study. J. Comput. Syst. Sci., 51(1):110–134, 1995.
- Conjunctive-query containment and constraint satisfaction. J. Comput. Syst. Sci., 61(2):302–332, 2000.
- On the power of the Weisfeiler-Leman test for graph motif parameters. CoRR, abs/2309.17053, 2023.
- Dániel Marx. Approximating fractional hypertree width. ACM Trans. Algorithms, 6(2):29:1–29:17, 2010.
- Dániel Marx. Tractable hypergraph properties for constraint satisfaction and conjunctive queries. Journal of the ACM, 60(6), 2013. Article No. 42.
- Stefan Mengel. A short note on the counting complexity of conjunctive queries. CoRR, abs/2112.01108, 2021.
- Carl A. Miller. Evasiveness of graph properties and topological fixed-point theorems. Found. Trends Theor. Comput. Sci., 7(4):337–415, 2013.
- Weisfeiler and Leman go neural: Higher-order graph neural networks. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 4602–4609. AAAI Press, 2019.
- Daniel Neuen. Homomorphism-distinguishing closedness for graphs of bounded tree-width. CoRR, abs/2304.07011, 2023.
- Tractable counting of the answers to conjunctive queries. J. Comput. Syst. Sci., 79(6):984–1001, 2013.
- Marc Roth. Parameterized counting of partially injective homomorphisms. Algorithmica, 83(6):1829–1860, 2021.
- Counting Induced Subgraphs: A Topological Approach to #W[1]-hardness. Algorithmica, 82(8):2267–2291, 2020.
- Complexity and algorithms for Euler characteristic of simplicial complexes. J. Symb. Comput., 50:170–196, 2013.
- Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs. SIAM J. Comput., 13(3):566–579, 1984.
- Moshe Y. Vardi. Constraint satisfaction and database theory: a tutorial. In Victor Vianu and Georg Gottlob, editors, Proceedings of the Nineteenth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, May 15-17, 2000, Dallas, Texas, USA, pages 76–85. ACM, 2000.
- Mihalis Yannakakis. Algorithms for acyclic database schemes. In Very Large Data Bases, 7th International Conference, September 9-11, 1981, Cannes, France, Proceedings, pages 82–94. IEEE Computer Society, 1981.