Ranked Enumeration for MSO on Trees via Knowledge Compilation

Authors Antoine Amarilli , Pierre Bourhis , Florent Capelli , Mikaël Monet

Thumbnail PDF


  • Filesize: 0.83 MB
  • 18 pages

Document Identifiers

Author Details

Antoine Amarilli
  • LTCI, Télécom Paris, Institut Polytechnique de Paris, France
Pierre Bourhis
  • Univ. Lille, CNRS, Inria, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
Florent Capelli
  • Univ. Artois, CNRS, UMR 8188, Centre de Recherche en Informatique de Lens (CRIL), F-62300 Lens, France
Mikaël Monet
  • Université de Lille, CNRS, Inria, UMR 9189 - CRIStAL, F-59000 Lille, France

Cite AsGet BibTex

Antoine Amarilli, Pierre Bourhis, Florent Capelli, and Mikaël Monet. Ranked Enumeration for MSO on Trees via Knowledge Compilation. In 27th International Conference on Database Theory (ICDT 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 290, pp. 25:1-25:18, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)


We study the problem of enumerating the satisfying assignments for certain circuit classes from knowledge compilation, where assignments are ranked in a specific order. In particular, we show how this problem can be used to efficiently perform ranked enumeration of the answers to MSO queries over trees, with the order being given by a ranking function satisfying a subset-monotonicity property. Assuming that the number of variables is constant, we show that we can enumerate the satisfying assignments in ranked order for so-called multivalued circuits that are smooth, decomposable, and in negation normal form (smooth multivalued DNNF). There is no preprocessing and the enumeration delay is linear in the size of the circuit times the number of values, plus a logarithmic term in the number of assignments produced so far. If we further assume that the circuit is deterministic (smooth multivalued d-DNNF), we can achieve linear-time preprocessing in the circuit, and the delay only features the logarithmic term.

Subject Classification

ACM Subject Classification
  • Information systems → Relational database model
  • Enumeration
  • knowledge compilation
  • monadic second-order logic


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. The design and analysis of computer algorithms. Addison-Wesley, 1974. Google Scholar
  2. Antoine Amarilli, Pierre Bourhis, Florent Capelli, and Mikaël Monet. Ranked enumeration for MSO on trees via knowledge compilation. CoRR, abs/2310.00731, 2023. Full version of this article with all proofs. URL: https://doi.org/10.48550/arXiv.2310.00731.
  3. Antoine Amarilli, Pierre Bourhis, Louis Jachiet, and Stefan Mengel. A circuit-based approach to efficient enumeration. In ICALP, 2017. URL: https://doi.org/10.4230/LIPIcs.ICALP.2017.111.
  4. Antoine Amarilli, Pierre Bourhis, Stefan Mengel, and Matthias Niewerth. Constant-delay enumeration for nondeterministic document spanners. In ICDT, 2019. URL: https://doi.org/10.4230/LIPIcs.ICDT.2019.22.
  5. Antoine Amarilli, Pierre Bourhis, Stefan Mengel, and Matthias Niewerth. Enumeration on trees with tractable combined complexity and efficient updates. In PODS, 2019. URL: https://doi.org/10.1145/3294052.3319702.
  6. Antoine Amarilli, Pierre Bourhis, and Pierre Senellart. Provenance circuits for trees and treelike instances. In ICALP, 2015. URL: https://doi.org/10.1007/978-3-662-47666-6_5.
  7. Guillaume Bagan. MSO queries on tree decomposable structures are computable with linear delay. In CSL, 2006. URL: https://doi.org/10.1007/11874683_11.
  8. Guillaume Bagan, Arnaud Durand, and Étienne Grandjean. On acyclic conjunctive queries and constant delay enumeration. In CSL, 2007. URL: https://doi.org/10.1007/978-3-540-74915-8_18.
  9. Nurzhan Bakibayev, Tomáš Kociskỳ, Dan Olteanu, and Jakub Závodnỳ. Aggregation and ordering in factorised databases. PVLDB, 6(14), 2013. URL: https://doi.org/10.14778/2556549.2556579.
  10. Christoph Berkholz, Jens Keppeler, and Nicole Schweikardt. Answering UCQs under updates and in the presence of integrity constraints. In ICDT, 2018. URL: https://doi.org/10.4230/LIPIcs.ICDT.2018.8.
  11. Pierre Bourhis, Laurence Duchien, Jérémie Dusart, Emmanuel Lonca, Pierre Marquis, and Clément Quinton. Pseudo polynomial-time top-k algorithms for d-dnnf circuits. CoRR, 2022. URL: https://doi.org/10.48550/arXiv.2202.05938.
  12. Pierre Bourhis, Alejandro Grez, Louis Jachiet, and Cristian Riveros. Ranked enumeration of MSO logic on words. In ICDT, 2021. URL: https://doi.org/10.4230/LIPIcs.ICDT.2021.20.
  13. Karl Bringmann, Nofar Carmeli, and Stefan Mengel. Tight fine-grained bounds for direct access on join queries. In PODS, 2022. URL: https://doi.org/10.1145/3517804.3526234.
  14. Karl Bringmann, Nofar Carmeli, and Stefan Mengel. Tight fine-grained bounds for direct access on join queries. CoRR, abs/2201.02401, 2022. URL: https://doi.org/10.48550/arXiv.2201.02401.
  15. Gerth Stølting Brodal and Chris Okasaki. Optimal purely functional priority queues. Journal of Functional Programming, 6(6), 1996. URL: https://doi.org/10.1017/S095679680000201X.
  16. Nofar Carmeli and Markus Kröll. On the enumeration complexity of unions of conjunctive queries. TODS, 46(2), 2021. URL: https://doi.org/10.1145/3450263.
  17. Nofar Carmeli, Nikolaos Tziavelis, Wolfgang Gatterbauer, Benny Kimelfeld, and Mirek Riedewald. Tractable orders for direct access to ranked answers of conjunctive queries. TODS, 48(1), 2023. URL: https://doi.org/10.1145/3578517.
  18. Adnan Darwiche and Pierre Marquis. A knowledge compilation map. Journal of Artificial Intelligence Research, 17, 2002. URL: https://doi.org/10.1613/jair.989.
  19. Shaleen Deep, Xiao Hu, and Paraschos Koutris. Ranked enumeration of join queries with projections. arXiv preprint, 2022. URL: https://doi.org/10.48550/arXiv.2201.05566.
  20. Shaleen Deep and Paraschos Koutris. Ranked enumeration of conjunctive query results. arXiv preprint, 2019. URL: https://doi.org/10.48550/arXiv.1902.02698.
  21. Johannes Doleschal, Benny Kimelfeld, Wim Martens, and Liat Peterfreund. Weight annotation in information extraction. Logical Methods in Computer Science, 18, 2022. URL: https://doi.org/10.46298/lmcs-18(1:21)2022.
  22. Manfred Droste and Paul Gastin. Weighted automata and weighted logics. In ICALP. Springer, 2005. URL: https://doi.org/10.1007/11523468_42.
  23. Arnaud Durand and Étienne Grandjean. First-order queries on structures of bounded degree are computable with constant delay. TOCL, 8(4), 2007. URL: https://doi.org/10.1145/1276920.1276923.
  24. Étienne Grandjean and Louis Jachiet. Which arithmetic operations can be performed in constant time in the RAM model with addition? arXiv preprint, 2022. URL: https://doi.org/10.48550/arXiv.2206.13851.
  25. Wojciech Kazana and Luc Segoufin. Enumeration of monadic second-order queries on trees. TOCL, 14(4), 2013. URL: https://doi.org/10.1145/2528928.
  26. Eugene L Lawler. A procedure for computing the k best solutions to discrete optimization problems and its application to the shortest path problem. Management science, 18(7), 1972. Google Scholar
  27. Leonid Libkin. Elements of finite model theory. Springer, 2004. URL: https://doi.org/10.1007/978-3-662-07003-1.
  28. Katja Losemann and Wim Martens. MSO queries on trees: Enumerating answers under updates. In CSL-LICS, 2014. URL: https://doi.org/10.1145/2603088.2603137.
  29. Katta G Murty. An algorithm for ranking all the assignments in order of increasing cost. Operations research, 16(3), 1968. URL: https://doi.org/10.1287/opre.16.3.682.
  30. Dan Olteanu and Jakub Závodnỳ. Size bounds for factorised representations of query results. TODS, 40(1), 2015. URL: https://doi.org/10.1145/2656335.
  31. Nicole Schweikardt, Luc Segoufin, and Alexandre Vigny. Enumeration for FO queries over nowhere dense graphs. JACM, 69(3), 2022. URL: https://doi.org/10.1145/3517035.
  32. Luc Segoufin. A glimpse on constant delay enumeration (invited talk). In STACS, 2014. URL: https://hal.inria.fr/hal-01070893/document, URL: https://doi.org/10.4230/LIPIcs.STACS.2014.13.
  33. Luc Segoufin and Alexandre Vigny. Constant delay enumeration for FO queries over databases with local bounded expansion. In ICDT, 2017. URL: https://doi.org/10.4230/LIPIcs.ICDT.2017.20.
  34. Andy Shih, Guy Van den Broeck, Paul Beame, and Antoine Amarilli. Smoothing structured decomposable circuits. In NeurIPS, 2019. URL: https://proceedings.neurips.cc/paper/2019/hash/940392f5f32a7ade1cc201767cf83e31-Abstract.html.
  35. Nikolaos Tziavelis, Deepak Ajwani, Wolfgang Gatterbauer, Mirek Riedewald, and Xiaofeng Yang. Optimal algorithms for ranked enumeration of answers to full conjunctive queries. PVLDB, 13(9), 2020. URL: https://doi.org/10.14778/3397230.3397250.
  36. Nikolaos Tziavelis, Wolfgang Gatterbauer, and Mirek Riedewald. Any-k algorithms for enumerating ranked answers to conjunctive queries. arXiv preprint, 2022. URL: https://doi.org/10.48550/arXiv.2205.05649.
  37. Kunihiro Wasa. Enumeration of enumeration algorithms. CoRR, 2016. URL: https://doi.org/10.48550/arXiv.1605.05102.
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail