Size Bounds and Algorithms for Conjunctive Regular Path Queries

Authors Tamara Cucumides, Juan Reutter, Domagoj Vrgoč

Thumbnail PDF


  • Filesize: 0.72 MB
  • 17 pages

Document Identifiers

Author Details

Tamara Cucumides
  • University of Antwerp, Belgium
  • Pontificia Universidad Católica de Chile, Santiago, Chile
Juan Reutter
  • Pontificia Universidad Católica de Chile, Santiago, Chile
  • Millennium Institute for Foundational Research on Data (IMFD), Santiago, Chile
Domagoj Vrgoč
  • University of Zagreb, Croatia
  • Pontificia Universidad Católica de Chile, Santiago, Chile

Cite AsGet BibTex

Tamara Cucumides, Juan Reutter, and Domagoj Vrgoč. Size Bounds and Algorithms for Conjunctive Regular Path Queries. In 26th International Conference on Database Theory (ICDT 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 255, pp. 13:1-13:17, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


Conjunctive regular path queries (CRPQs) are one of the core classes of queries over graph databases. They are join intensive, inheriting their structure from the relational setting, but they also allow arbitrary length paths to connect points that are to be joined. However, despite their popularity, little is known about what are the best algorithms for processing CRPQs. We focus on worst-case optimal algorithms, which are algorithms that run in time bounded by the worst-case output size of queries, and have been recently deployed for simpler graph queries with very promising results. We show that the famous bound on the number of query results by Atserias, Grohe and Marx can be extended to CRPQs, but to obtain tight bounds one needs to work with slightly stronger cardinality profiles. We also discuss what algorithms follow from our analysis. If one pays the cost for fully materializing graph queries, then the techniques developed for conjunctive queries can be reused. If, on the other hand, one imposes constraint on the working memory of algorithms, then worst-case optimal algorithms must be adapted with care: the order of variables in which queries are processed can have striking implications on the running time of queries.

Subject Classification

ACM Subject Classification
  • Information systems → Query languages
  • graph databases
  • regular path queries
  • worst-case optimal algorithms


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


  1. Renzo Angles, Marcelo Arenas, Pablo Barceló, Aidan Hogan, Juan L. Reutter, and Domagoj Vrgoc. Foundations of Modern Query Languages for Graph Databases. ACM Comput. Surv., 50(5):68:1-68:40, 2017. Google Scholar
  2. Diego Arroyuelo, Aidan Hogan, Gonzalo Navarro, Juan L. Reutter, Javiel Rojas-Ledesma, and Adrián Soto. Worst-case optimal graph joins in almost no space. In Guoliang Li, Zhanhuai Li, Stratos Idreos, and Divesh Srivastava, editors, SIGMOD '21: International Conference on Management of Data, Virtual Event, China, June 20-25, 2021, pages 102-114. ACM, 2021. Google Scholar
  3. Diego Arroyuelo, Aidan Hogan, Gonzalo Navarro, and Javiel Rojas-Ledesma. Time-and space-efficient regular path queries on graphs. arXiv preprint, 2021. URL:
  4. Albert Atserias, Martin Grohe, and Dániel Marx. Size bounds and query plans for relational joins. SIAM J. Comput., 42(4):1737-1767, 2013. Google Scholar
  5. Pablo Barceló Baeza. Querying graph databases. In Proceedings of the 32nd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2013, New York, NY, USA - June 22-27, 2013, pages 175-188, 2013. Google Scholar
  6. Angela Bonifati, Wim Martens, and Thomas Timm. An analytical study of large SPARQL query logs. VLDB J., 29(2-3):655-679, 2020. Google Scholar
  7. Katrin Casel and Markus L. Schmid. Fine-grained complexity of regular path queries. In 24th International Conference on Database Theory, ICDT 2021, March 23-26, 2021, Nicosia, Cyprus, pages 19:1-19:20, 2021. Google Scholar
  8. Michael J. Freitag, Maximilian Bandle, Tobias Schmidt, Alfons Kemper, and Thomas Neumann. Adopting worst-case optimal joins in relational database systems. Proc. VLDB Endow., 13(11):1891-1904, 2020. Google Scholar
  9. Georg Gottlob, Stephanie Tien Lee, Gregory Valiant, and Paul Valiant. Size and treewidth bounds for conjunctive queries. J. ACM, 59(3):16:1-16:35, 2012. Google Scholar
  10. Aidan Hogan, Cristian Riveros, Carlos Rojas, and Adrián Soto. A worst-case optimal join algorithm for SPARQL. In The Semantic Web - ISWC 2019 - 18th International Semantic Web Conference, Auckland, New Zealand, October 26-30, 2019, Proceedings, Part I, pages 258-275, 2019. Google Scholar
  11. Thomas Neumann and Gerhard Weikum. Rdf-3x: a risc-style engine for rdf. Proceedings of the VLDB Endowment, 1(1):647-659, 2008. Google Scholar
  12. Thomas Neumann and Gerhard Weikum. The rdf-3x engine for scalable management of rdf data. The VLDB Journal, 19(1):91-113, 2010. Google Scholar
  13. Hung Q. Ngo, Christopher Ré, and Atri Rudra. Skew strikes back: new developments in the theory of join algorithms. SIGMOD Rec., 42(4):5-16, 2013. Google Scholar
  14. Dung Nguyen, Molham Aref, Martin Bravenboer, George Kollias, Hung Q Ngo, Christopher Ré, and Atri Rudra. Join processing for graph patterns: An old dog with new tricks. In Proceedings of the GRADES'15, pages 1-8. ACM, 2015. Google Scholar
  15. Jena Team. TDB Documentation, 2021. URL:
  16. Todd L. Veldhuizen. Triejoin: A simple, worst-case optimal join algorithm. In Nicole Schweikardt, Vassilis Christophides, and Vincent Leroy, editors, Proc. 17th International Conference on Database Theory (ICDT), Athens, Greece, March 24-28, 2014, pages 96-106., 2014. Google Scholar
  17. Virginia Vassilevska Williams and R Ryan Williams. Subcubic equivalences between path, matrix, and triangle problems. Journal of the ACM (JACM), 65(5):1-38, 2018. Google Scholar
  18. Peter T. Wood. Query languages for graph databases. SIGMOD Rec., 41(1):50-60, 2012. Google Scholar
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