Abstract
In the path reporting problem, we preprocess a tree on n nodes each of which is assigned a weight, such that given an arbitrary path and a weight range, we can report the nodes whose weights are within the range. We consider this problem in dynamic settings, and propose the first non-trivial linear-space solution that supports path reporting in \(O((\lg n{/}\lg \lg n)^2 + occ \lg n{/}\lg \lg n)\) time, where occ is the output size, and the insertion and deletion of a node of an arbitrary degree in \(O(\lg ^{2+\epsilon } n)\) amortized time, for any constant \(\epsilon \in (0, 1)\). Obvious solutions based on directly dynamizing solutions to the static version of this problem all require \(\Omega ((\lg n{/}\lg \lg n)^2)\) time for each node reported, and thus our query time is much faster. We also design data structures that support path counting and path reporting queries in \(O((\lg n{/}\lg \lg n)^2)\) time, and insertions and deletions in \(O((\lg n{/}\lg \lg n)^2)\) amortized time. This matches the best known results for dynamic two-dimensional range counting (He and Munro in Comput Geom 47(2):268–281, 2014) and range selection (He et al., in: Proceedings of the 22nd international symposium on algorithms and computation, ISAAC, Yokohama, Japan, 2011), which can be viewed as special cases of path counting and path selection.







Similar content being viewed by others
Notes
We use \(\lg \) to denote the base-2 logarithm.
A generalized version of this operation was referred to as the method-lookup problem in previous work [28], where the authors considered static trees and multi-labeled nodes. Incidentally, their approach is similar to tree extraction but requires more space.
References
Alon, N., Schieber, B.: Optimal preprocessing for answering on-line product queries. Technical Reports on Tel Aviv University (1987)
Alstrup, S., Holm, J.: Improved algorithms for finding level ancestors in dynamic trees. In: Proceedings of the 27th International Colloquium on Automata, Languages and Programming, ICALP 2000, Geneva, Switzerland, July 9–15, pp. 73–84 (2000)
Alstrup, S., Husfeldt, T., Rauhe, T.: Marked ancestor problems. In: 39th Annual Symposium on Foundations of Computer Science, FOCS ’98, Palo Alto, California, USA, November 8–11, pp. 534–544 (1998)
Arge, L., Vitter, J.S.: Optimal external memory interval management. SIAM J. Comput. 32(6), 1488–1508 (2003)
Bille, P.: A survey on tree edit distance and related problems. Theor. Comput. Sci. 337(1–3), 217–239 (2005)
Blelloch, G.E.: Space-efficient dynamic orthogonal point location, segment intersection, and range reporting. In: Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2008, San Francisco, California, USA, January 20–22, pp. 894–903 (2008)
Brodal, G.S., Davoodi, P., Lewenstein, M., Raman, R., Rao, S.S.: Two dimensional range minimum queries and fibonacci lattices. In: Proceedings of the 20th Annual European Symposium on Algorithms, ESA 2012, Ljubljana, Slovenia, September 10–12, pp. 217–228 (2012)
Brodal, G.S., Davoodi, P., Rao, S.S.: Path minima queries in dynamic weighted trees. In: Proceedings of the 12th International Symposium Workshop on Algorithms and Data Structures, WADS 2011, New York, NY, USA, August 15–17, pp. 290–301 (2011)
Brodal, G.S., Gfeller, B., Jørgensen, A.G., Sanders, P.: Towards optimal range medians. Theor. Comput. Sci. 412(24), 2588–2601 (2011)
Chan, T.M., He, M., Munro, J.I., Zhou, G.: Succinct indices for path minimum, with applications to path reporting. In: Proceedings of the 22th Annual European Symposium on Algorithms, ESA 2014, Wroclaw, Poland, September 8–10, pp. 247–259 (2014)
Chazelle, B.: Computing on a free tree via complexity-preserving mappings. Algorithmica 2, 337–361 (1987)
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press, Cambridge (2009)
Demaine, E.D., Landau, G.M., Weimann, O.: On cartesian trees and range minimum queries. Algorithmica 68(3), 610–625 (2014)
Frederickson, G.N.: Data structures for on-line updating of minimum spanning trees, with applications. SIAM J. Comput. 14(4), 781–798 (1985)
Frederickson, G.N.: Ambivalent data structures for dynamic 2-edge-connectivity and k smallest spanning trees. SIAM J. Comput. 26(2), 484–538 (1997)
Frederickson, G.N.: A data structure for dynamically maintaining rooted trees. J. Algorithms 24(1), 37–65 (1997)
He, M., Munro, J.I.: Succinct representations of dynamic strings. In: Proceedings of the 17th International Symposium on String Processing and Information Retrieval, SPIRE 2010, Los Cabos, Mexico, October 11–13, pp. 334–346 (2010)
He, M., Munro, J.I.: Space efficient data structures for dynamic orthogonal range counting. Comput. Geom. 47(2), 268–281 (2014)
He, M., Munro, J.I., Nicholson, P.K.: Dynamic range selection in linear space. In: Proceedings of the 22nd International Symposium on Algorithms and Computation, ISAAC 2011, Yokohama, Japan, December 5–8, pp. 160–169 (2011)
He, M., Munro, J.I., Rao, S.S.: Succinct ordinal trees based on tree covering. ACM Trans. Algorithms 8(4), 42 (2012)
He, M., Munro, J.I., Zhou, G.: Path queries in weighted trees. In: Proceedings of the 22nd International Symposium on Algorithms and Computation, ISAAC 2011, Yokohama, Japan, December 5–8, pp. 140–149 (2011)
He, M., Munro, J.I., Zhou, G.: Succinct data structures for path queries. In: Proceedings of the 20th Annual European Symposium on Algorithms, ESA 2012, Ljubljana, Slovenia, September 10–12, pp. 575–586 (2012)
He, M., Munro, J.I., Zhou, G.: Dynamic path counting and reporting in linear space. In: Proceedings of the 25th International Symposium on Algorithms and Computation, ISAAC 2014, Jeonju, Korea, December 15–17, pp. 565–577 (2014)
He, M., Munro, J.I., Zhou, G.: A framework for succinct labeled ordinal trees over large alphabets. Algorithmica 70(4), 696–717 (2014)
Kaplan, H., Shafrir, N.: Path minima in incremental unrooted trees. In: Proceedings of the 16th Annual European Symposium on Algorithms, ESA 2008, Karlsruhe, Germany, September 15–17, pp. 565–576 (2008)
Krizanc, D., Morin, P., Smid, M.H.M.: Range mode and range median queries on lists and trees. Nord. J. Comput. 12(1), 1–17 (2005)
Munro, J.I., Raman, V.: Succinct representation of balanced parentheses and static trees. SIAM J. Comput. 31(3), 762–776 (2001)
Muthukrishnan, S., Müller, M.: Time and space efficient method-lookup for object-oriented programs (extended abstract). In: Proceedings of the Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 1996, Atlanta, Georgia, USA, January 28–30, pp. 42–51 (1996)
Navarro, G., Nekrich, Y.: Optimal dynamic sequence representations. SIAM J. Comput. 43(5), 1781–1806 (2014)
Navarro, G., Sadakane, K.: Fully functional static and dynamic succinct trees. ACM Trans. Algorithms 10(3), 16 (2014)
Nekrich, Y.: Orthogonal range searching in linear and almost-linear space. Comput. Geom. 42(4), 342–351 (2009)
Patil, M., Shah, R., Thankachan, S.V.: Succinct representations of weighted trees supporting path queries. J. Discrete Algorithms 17, 103–108 (2012)
Pǎtraşcu, M., Demaine, E.D.: Logarithmic lower bounds in the cell-probe model. SIAM J. Comput. 35(4), 932–963 (2006)
Raman, R., Raman, V., Rao, S.S.: Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans. Algorithms 3(4), 43 (2007). https://doi.org/10.1145/1290672.1290680
Author information
Authors and Affiliations
Corresponding author
Additional information
The preliminary partial version of this article was published in the Proceedings of the 25th International Symposium on Algorithms and Computation (ISAAC 2014) [23]. This work was supported by NSERC and the Canada Research Chairs Program.
Rights and permissions
About this article
Cite this article
He, M., Munro, J.I. & Zhou, G. Dynamic Path Queries in Linear Space. Algorithmica 80, 3728–3765 (2018). https://doi.org/10.1007/s00453-018-0413-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-018-0413-x