Path Query Data Structures in Practice

Authors Meng He, Serikzhan Kazi

Thumbnail PDF


  • Filesize: 0.78 MB
  • 16 pages

Document Identifiers

Author Details

Meng He
  • Faculty of Computer Science, Dalhousie University, Halifax, Canada
Serikzhan Kazi
  • Faculty of Computer Science, Dalhousie University, Halifax, Canada

Cite AsGet BibTex

Meng He and Serikzhan Kazi. Path Query Data Structures in Practice. In 18th International Symposium on Experimental Algorithms (SEA 2020). Leibniz International Proceedings in Informatics (LIPIcs), Volume 160, pp. 27:1-27:16, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2020)


We perform experimental studies on data structures that answer path median, path counting, and path reporting queries in weighted trees. These query problems generalize the well-known range median query problem in arrays, as well as the 2d orthogonal range counting and reporting problems in planar point sets, to tree structured data. We propose practical realizations of the latest theoretical results on path queries. Our data structures, which use tree extraction, heavy-path decomposition and wavelet trees, are implemented in both succinct and pointer-based form. Our succinct data structures are further specialized to be plain or entropy-compressed. Through experiments on large sets, we show that succinct data structures for path queries may present a viable alternative to standard pointer-based realizations, in practical scenarios. Compared to naïve approaches that compute the answer by explicit traversal of the query path, our succinct data structures are several times faster in path median queries and perform comparably in path counting and path reporting queries, while being several times more space-efficient. Plain pointer-based realizations of our data structures, requiring a few times more space than the naïve ones, yield up to 100-times speed-up over them.

Subject Classification

ACM Subject Classification
  • Information systems → Data structures
  • path query
  • path median
  • path counting
  • path reporting
  • weighted tree


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


  1. KIT roadgraphs. Accessed: 07/12/2018. URL:
  2. ltree module for PostreSQL RDBMS. Accessed: 10/01/2020. URL:
  3. MOLA Mars Orbiter Laser Altimeter data from NASA Mars Global Surveyor. Accessed: 10/01/2019. URL:
  4. SRTM Shuttle Radar Topography Mission. Accessed: 10/01/2019. URL:
  5. Andrés Abeliuk, Rodrigo Cánovas, and Gonzalo Navarro. Practical compressed suffix trees. Algorithms, 6(2):319-351, 2013. URL:
  6. Ravindra K. Ahuja, Thomas L. Magnanti, and James B. Orlin. Network flows - theory, algorithms and applications. Prentice Hall, 1993. Google Scholar
  7. Noga Alon and Baruch Schieber. Optimal preprocessing for answering on-line product queries. Technical report, Tel-Aviv University, 1987. Google Scholar
  8. Diego Arroyuelo, Rodrigo Cánovas, Gonzalo Navarro, and Kunihiko Sadakane. Succinct trees in practice. In Proceedings of the Twelfth Workshop on Algorithm Engineering and Experiments, ALENEX 2010, Austin, Texas, USA, January 16, 2010, pages 84-97, 2010. URL:
  9. Diego Arroyuelo, Francisco Claude, Reza Dorrigiv, Stephane Durocher, Meng He, Alejandro López-Ortiz, J. Ian Munro, Patrick K. Nicholson, Alejandro Salinger, and Matthew Skala. Untangled monotonic chains and adaptive range search. Theor. Comput. Sci., 412(32):4200-4211, 2011. URL:
  10. Michael A. Bender, Martin Farach-Colton, Giridhar Pemmasani, Steven Skiena, and Pavel Sumazin. Lowest common ancestors in trees and directed acyclic graphs. J. Algorithms, 57(2):75-94, 2005. URL:
  11. David Benoit, Erik D. Demaine, J. Ian Munro, Rajeev Raman, Venkatesh Raman, and S. Srinivasa Rao. Representing trees of higher degree. Algorithmica, 43(4):275-292, 2005. URL:
  12. Nieves R. Brisaboa, Guillermo de Bernardo, Roberto Konow, Gonzalo Navarro, and Diego Seco. Aggregated 2d range queries on clustered points. Inf. Syst., 60:34-49, 2016. URL:
  13. Timothy M. Chan, Meng He, J. Ian Munro, and Gelin Zhou. Succinct indices for path minimum, with applications. Algorithmica, 78(2):453-491, 2017. URL:
  14. Timothy M. Chan, Kasper Green Larsen, and Mihai Patrascu. Orthogonal range searching on the ram, revisited. In Computational Geometry, 27th ACM Symposium, SoCG 2011, Paris, France, June 13-15, 2011. Proceedings, pages 1-10, 2011. URL:
  15. Bernard Chazelle. Computing on a free tree via complexity-preserving mappings. Algorithmica, 2(1):337-361, November 1987. URL:
  16. Francisco Claude, J. Ian Munro, and Patrick K. Nicholson. Range queries over untangled chains. In String Processing and Information Retrieval - 17th International Symposium, SPIRE 2010, Los Cabos, Mexico, October 11-13, 2010. Proceedings, pages 82-93, 2010. URL:
  17. O'Neil Delpratt, Naila Rahman, and Rajeev Raman. Engineering the LOUDS succinct tree representation. In Experimental Algorithms, 5th International Workshop, WEA 2006, Cala Galdana, Menorca, Spain, May 24-27, 2006, Proceedings, pages 134-145, 2006. URL:
  18. Arash Farzan and J. Ian Munro. A uniform paradigm to succinctly encode various families of trees. Algorithmica, 68(1):16-40, 2014. URL:
  19. Travis Gagie, Simon J. Puglisi, and Andrew Turpin. Range quantile queries: Another virtue of wavelet trees. In String Processing and Information Retrieval, 16th International Symposium, SPIRE 2009, Saariselkä, Finland, August 25-27, 2009, Proceedings, pages 1-6, 2009. URL:
  20. Richard F. Geary, Naila Rahman, Rajeev Raman, and Venkatesh Raman. A simple optimal representation for balanced parentheses. Theor. Comput. Sci., 368(3):231-246, 2006. URL:
  21. Richard F. Geary, Rajeev Raman, and Venkatesh Raman. Succinct ordinal trees with level-ancestor queries. ACM Trans. Algorithms, 2(4):510-534, 2006. URL:
  22. Simon Gog, Timo Beller, Alistair Moffat, and Matthias Petri. From theory to practice: Plug and play with succinct data structures. In Experimental Algorithms - 13th International Symposium, SEA 2014, Copenhagen, Denmark, June 29 - July 1, 2014. Proceedings, pages 326-337, 2014. URL:
  23. Torben Hagerup. Parallel preprocessing for path queries without concurrent reading. Inf. Comput., 158(1):18-28, 2000. URL:
  24. Meng He and Serikzhan Kazi. Path and ancestor queries over trees with multidimensional weight vectors. In 30th International Symposium on Algorithms and Computation, ISAAC 2019, December 8-11, 2019, Shanghai University of Finance and Economics, Shanghai, China, pages 45:1-45:17, 2019. URL:
  25. Meng He, J. Ian Munro, and Srinivasa Rao Satti. Succinct ordinal trees based on tree covering. ACM Trans. Algorithms, 8(4):42:1-42:32, 2012. URL:
  26. Meng He, J. Ian Munro, and Gelin Zhou. Path queries in weighted trees. In Algorithms and Computation - 22nd International Symposium, ISAAC 2011, Yokohama, Japan, December 5-8, 2011. Proceedings, pages 140-149, 2011. URL:
  27. Meng He, J. Ian Munro, and Gelin Zhou. A framework for succinct labeled ordinal trees over large alphabets. Algorithmica, 70(4):696-717, 2014. URL:
  28. Meng He, J. Ian Munro, and Gelin Zhou. Data structures for path queries. ACM Trans. Algorithms, 12(4):53:1-53:32, 2016. URL:
  29. Kazuki Ishiyama and Kunihiko Sadakane. A succinct data structure for multidimensional orthogonal range searching. In 2017 Data Compression Conference, DCC 2017, Snowbird, UT, USA, April 4-7, 2017, pages 270-279, 2017. URL:
  30. Guy Jacobson. Space-efficient static trees and graphs. In 30th Annual Symposium on Foundations of Computer Science, Research Triangle Park, North Carolina, USA, 30 October - 1 November 1989, pages 549-554, 1989. URL:
  31. Jesper Jansson, Kunihiko Sadakane, and Wing-Kin Sung. Ultra-succinct representation of ordered trees with applications. J. Comput. Syst. Sci., 78(2):619-631, 2012. URL:
  32. Danny Krizanc, Pat Morin, and Michiel H. M. Smid. Range mode and range median queries on lists and trees. Nord. J. Comput., 12(1):1-17, 2005. Google Scholar
  33. Hsueh-I Lu and Chia-Chi Yeh. Balanced parentheses strike back. ACM Trans. Algorithms, 4(3):28:1-28:13, 2008. URL:
  34. J. Ian Munro, Rajeev Raman, Venkatesh Raman, and S. Srinivasa Rao. Succinct representations of permutations and functions. Theor. Comput. Sci., 438:74-88, 2012. URL:
  35. J. Ian Munro and Venkatesh Raman. Succinct representation of balanced parentheses and static trees. SIAM J. Comput., 31(3):762-776, 2001. URL:
  36. David R. Musser. Introspective sorting and selection algorithms. Softw., Pract. Exper., 27(8):983-993, 1997. URL:;2-%23.
  37. Gonzalo Navarro. Compact Data Structures - A Practical Approach. Cambridge University Press, 2016. URL:
  38. Gonzalo Navarro and Alberto Ordó~nez Pereira. Faster compressed suffix trees for repetitive collections. ACM Journal of Experimental Algorithmics, 21(1):1.8:1-1.8:38, 2016. URL:
  39. OpenStreetMap contributors. Planet dump retrieved from . , 2017. URL:
  40. Manish Patil, Rahul Shah, and Sharma V. Thankachan. Succinct representations of weighted trees supporting path queries. J. Discrete Algorithms, 17:103-108, 2012. URL:
  41. Rajeev Raman, Venkatesh Raman, and Srinivasa Rao Satti. Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans. Algorithms, 3(4):43, 2007. URL:
  42. A. Rényi and G. Szekeres. On the height of trees. Journal of the Australian Mathematical Society, 7(4):497-507, 1967. Google Scholar
  43. Daniel D. Sleator and Robert Endre Tarjan. A data structure for dynamic trees. J. Comput. Syst. Sci., 26(3):362-391, June 1983. URL:
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