Algorithmica

, Volume 78, Issue 2, pp 453–491

# Succinct Indices for Path Minimum, with Applications

• Timothy M. Chan
• Meng He
• J. Ian Munro
• Gelin Zhou
Article

## Abstract

In the path minimum problem, we preprocess a tree on n weighted nodes, such that given an arbitrary path, the node with the smallest weight along this path can be located. We design novel succinct indices for this problem under the indexing model, for which weights of nodes are read-only and can be accessed with ranks of nodes in the preorder traversal sequence of the input tree. We present
• an index within O(m) bits of additional space that supports queries in $$O(\varvec{\alpha }(m, n))$$ time and $$O(\varvec{\alpha }(m, n))$$ accesses to the weights of nodes, for any integer $$m \ge n$$; and

• an index within $$2n + o(n)$$ bits of additional space that supports queries in $$O(\varvec{\alpha }(n))$$ time and $$O(\varvec{\alpha }(n))$$ accesses to the weights of nodes.

Here $$\varvec{\alpha }(m, n)$$ is the inverse-Ackermann function, and $$\varvec{\alpha }(n) = \varvec{\alpha }(n, n)$$. These indices give us the first succinct data structures for the path minimum problem. Following the same approach, we also develop succinct data structures for semigroup path sum queries, for which a query asks for the sum of weights along a given query path. One of our data structures requires $$n\lg \sigma + 2n + o(n\lg \sigma )$$ bits of space and $$O(\varvec{\alpha }(n))$$ query time, where $$\sigma$$ is the size of the semigroup. In the path reporting problem, queries ask for the nodes along a query path whose weights are within a two-sided query range. Using the succinct indices for path minimum queries, we achieve three different time/space tradeoffs for path reporting by designing
• an O(n)-word data structure with $$O(\lg ^\epsilon n + occ \cdot \lg ^\epsilon n)$$ query time;

• an $$O(n\lg \lg n)$$-word data structure with $$O(\lg \lg n + occ \cdot \lg \lg n)$$ query time; and

• an $$O(n \lg ^\epsilon n)$$-word data structure with $$O(\lg \lg n + occ)$$ query time.

Here occ is the number of nodes reported and $$\epsilon$$ is an arbitrary constant between 0 and 1. These tradeoffs match the state of the art of two-dimensional orthogonal range reporting queries (Chan et al. 2011), which can be treated as a special case of path reporting queries. When the number of distinct weights is much smaller than n, we further improve both the query time and the space cost of these three results.

## Keywords

Path minimum Semigroup path sum Path reporting Succinct data structures Succinct encoding of directed topology trees

## References

1. 1.
Alon, N., Schieber, B.: Optimal preprocessing for answering on-line product queries. Technical report, Tel Aviv University, (1987)Google Scholar
2. 2.
Alstrup, S., Brodal, G.S., Rauhe, T.: Optimal static range reporting in one dimension. In: Proceedings of the 33rd Annual ACM Symposium on Theory of Computing, STOC 2001, Heraklion, Crete, Greece, 6–8 July 2001, pp. 476–482, (2001)Google Scholar
3. 3.
Alstrup, S., Holm, J.: Improved algorithms for finding level ancestors in dynamic trees. In: Automata, Languages and Programming, 27th International Colloquium, ICALP 2000, Geneva, Switzerland, 9–15 July 2000, Proceedings, pp. 73–84, (2000)Google Scholar
4. 4.
Barbay, J., He, M., Munro, J.I., Satti, S.R.: Succinct indexes for strings, binary relations and multilabeled trees. ACM Trans. Algorithms 7(4), 52 (2011)
5. 5.
Bille, P.: A survey on tree edit distance and related problems. Theor. Comput. Sci. 337(1–3), 217–239 (2005)
6. 6.
Bose, P., He, M., Maheshwari, A., Morin, P.: Succinct orthogonal range search structures on a grid with applications to text indexing. In: Algorithms and Data Structures, 11th International Symposium, WADS 2009, Banff, Canada, 21–23 August 2009. Proceedings, pp. 98–109, (2009)Google Scholar
7. 7.
Bringmann, K., Larsen, K.G.: Succinct sampling from discrete distributions. In: Proceedings of the 45th Annual ACM Symposium on Theory of Computing, STOC 2013, Palo Alto, California, USA, 1–4 June 2013, pp. 775–782, (2013)Google Scholar
8. 8.
Brodal, G.S., Davoodi, P., Lewenstein, M., Raman, R., Rao, S.S.: Two dimensional range minimum queries and fibonacci lattices. In: Algorithms—ESA 2012—20th Annual European Symposium, Ljubljana, Slovenia, 10–12 September 2012. Proceedings, pp. 217–228, (2012)Google Scholar
9. 9.
Brodal, G.S., Davoodi, P., Rao, S.S.: Path minima queries in dynamic weighted trees. In: Algorithms and Data Structures—12th International Symposium, WADS 2011, New York, NY, USA, 15–17 August 2011. Proceedings, pp. 290–301, (2011)Google Scholar
10. 10.
Brodal, G.S., Davoodi, P., Rao, S.S.: On space efficient two dimensional range minimum data structures. Algorithmica 63(4), 815–830 (2012)
11. 11.
Buchsbaum, A.L., Georgiadis, L., Kaplan, H., Rogers, A., Tarjan, R.E., Westbrook, J.: Linear-time algorithms for dominators and other path-evaluation problems. SIAM J. Comput. 38(4), 1533–1573 (2008)
12. 12.
Chan, T.M., He, M., Munro, J.I., Zhou, G.: Succinct indices for path minimum, with applications to path reporting. In: Algorithms—ESA 2014—22th Annual European Symposium, Wroclaw, Poland, 8–10 September 2014. Proceedings, pp. 247–259, (2014)Google Scholar
13. 13.
Chan, T.M., Larsen, K.G., Pǎtraşcu, M.: Orthogonal range searching on the RAM, revisited. In: Proceedings of the 27th ACM Symposium on Computational Geometry, SoCG 2011, Paris, France, 13–15 June 2011, pp. 1–10, (2011)Google Scholar
14. 14.
Chazelle, B.: Computing on a free tree via complexity-preserving mappings. Algorithmica 2(1), 337–361 (1987)
15. 15.
Chazelle, B., Rosenberg, B.: The complexity of computing partial sums off-line. Int. J. Comput. Geom. Appl. 1(1), 33–45 (1991)
16. 16.
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press, Cambridge (2009)
17. 17.
Demaine, E.D., Landau, G.M., Weimann, O.: On cartesian trees and range minimum queries. Algorithmica 68(3), 610–625 (2014)
18. 18.
Demaine, E.D., López-Ortiz, A.: A linear lower bound on index size for text retrieval. J. Algorithms 48(1), 2–15 (2003)
19. 19.
Dixon, B., Rauch, M., Tarjan, R.E.: Verification and sensitivity analysis of minimum spanning trees in linear time. SIAM J. Comput. 21(6), 1184–1192 (1992)
20. 20.
Durocher, S., Shah, R., Skala, M., Thankachan, S.V.: Linear-space data structures for range frequency queries on arrays and trees. In: Mathematical Foundations of Computer Science 2013—38th International Symposium, MFCS 2013, Klosterneuburg, Austria, 26–30 August 2013. Proceedings, pp. 325–336, (2013)Google Scholar
21. 21.
Durocher, S., Shah, R., Skala, M., Thankachan, S.V.: Top-k color queries on tree paths. In: String Processing and Information Retrieval—20th International Symposium, SPIRE 2013, Jerusalem, Israel, 7–9 October 2013, Proceedings, pp. 109–115, (2013)Google Scholar
22. 22.
Farzan, A., Munro, J.I.: A uniform paradigm to succinctly encode various families of trees. Algorithmica 68(1), 16–40 (2014)
23. 23.
Farzan, A., Raman, R., Rao, S.S.: Universal succinct representations of trees? In: Automata, Languages and Programming, 36th International Colloquium, ICALP 2009, Rhodes, Greece, 5–12 July 2009, Proceedings, Part I, pp. 451–462, (2009)Google Scholar
24. 24.
Ferragina, P., Manzini, G., Mäkinen, V., Navarro, G.: Compressed representations of sequences and full-text indexes. ACM Trans. Algorithms 3(2), 20 (2007)Google Scholar
25. 25.
Fischer, J., Heun, V.: Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM J. Comput. 40(2), 465–492 (2011)
26. 26.
Frederickson, G.N.: Data structures for on-line updating of minimum spanning trees, with applications. SIAM J. Comput. 14(4), 781–798 (1985)
27. 27.
Frederickson, G.N.: Ambivalent data structures for dynamic 2-edge-connectivity and k smallest spanning trees. SIAM J. Comput. 26(2), 484–538 (1997)
28. 28.
Frederickson, G.N.: A data structure for dynamically maintaining rooted trees. J. Algorithms 24(1), 37–65 (1997)
29. 29.
Gabow, H.N.: Data structures for weighted matching and nearest common ancestors with linking. In: Proceedings of the First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 1990, San Francisco, California, USA, 22–24 January 1990, pp. 434–443, (1990)Google Scholar
30. 30.
Geary, R.F., Raman, R., Raman, V.: Succinct ordinal trees with level-ancestor queries. ACM Trans. Algorithms 2(4), 510–534 (2006)
31. 31.
Golynski, A.: Optimal lower bounds for rank and select indexes. Theor. Comput. Sci. 387(3), 348–359 (2007)
32. 32.
Grossi, R., Orlandi, A., Raman, R., Rao, S.S.: More haste, less waste: Lowering the redundancy in fully indexable dictionaries. In: Proceedings of the 29th International Symposium on Theoretical Aspects of Computer Science, volume 25 of Leibniz International Proceedings in Informatics (LIPIcs), pp. 517–528, Dagstuhl, Germany, (2009). Schloss Dagstuhl–Leibniz-Zentrum fuer InformatikGoogle Scholar
33. 33.
Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)
34. 34.
He, M., Munro, J.I., Satti, S.R.: Succinct ordinal trees based on tree covering. ACM Trans. Algorithms 8(4), 42 (2012)
35. 35.
He, M., Munro, J.I., Zhou, G.: Path queries in weighted trees. In: Algorithms and Computation—22nd International Symposium, ISAAC 2011, Yokohama, Japan, 5–8 December 2011. Proceedings, pp. 140–149, (2011)Google Scholar
36. 36.
He, M., Munro, J.I., Zhou, G.: Succinct data structures for path queries. In Algorithms—ESA 2012—20th Annual European Symposium, Ljubljana, Slovenia, 10–12 September 2012. Proceedings, pp. 575–586, (2012)Google Scholar
37. 37.
He, M., Munro, J.I., Zhou, G.: Dynamic path counting and reporting in linear space. In: Algorithms and Computation—25th International Symposium, ISAAC 2014, Jeonju, Korea, 15–17 December 2014, Proceedings, pp. 565–577, (2014)Google Scholar
38. 38.
Meng, H., Munro, J.I., Zhou, G.: A framework for succinct labeled ordinal trees over large alphabets. Algorithmica 70(4), 696–717 (2014)
39. 39.
Kaplan, H., S., Nira: Path minima in incremental unrooted trees. In: Algorithms—ESA 2008, 16th Annual European Symposium, Karlsruhe, Germany, 15–17 September 2008. Proceedings, pp. 565–576, (2008)Google Scholar
40. 40.
King, V.: A simpler minimum spanning tree verification algorithm. Algorithmica 18(2), 263–270 (1997)
41. 41.
Komlós, J.: Linear verification for spanning trees. Combinatorica 5(1), 57–65 (1985)
42. 42.
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)
43. 43.
Miltersen, P.B.: Lower bounds on the size of selection and rank indexes. In: Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2005, Vancouver, British Columbia, Canada, 23–25 January 2005, pp. 11–12, (2005)Google Scholar
44. 44.
Munro, J.I., Raman, V.: Succinct representation of balanced parentheses and static trees. SIAM J. Comput. 31(3), 762–776 (2001)
45. 45.
Nivasch, G.: Inverse ackermann without pain. http://www.gabrielnivasch.org/fun/inverse-ackermann
46. 46.
Patil, M., Shah, R., Thankachan, S.V.: Succinct representations of weighted trees supporting path queries. J. Discrete Algorithms 17, 103–108 (2012)
47. 47.
Pettie, S.: An inverse-ackermann type lower bound for online minimum spanning tree verification. Combinatorica 26(2), 207–230 (2006)
48. 48.
Raman, R., Raman, V., Satti, S.R.: Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans. Algorithms 3(4), 43 (2007)Google Scholar
49. 49.
Sadakane, K., Grossi, R.: Squeezing succinct data structures into entropy bounds. In: Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, 22–26 January 2006, pp. 1230–1239, (2006)Google Scholar
50. 50.
Sleator, D.D., Tarjan, R.E.: A data structure for dynamic trees. J. Comput. Syst. Sci. 26(3), 362–391 (1983)
51. 51.
Vuillemin, J.: A unifying look at data structures. Commun. ACM 23(4), 229–239 (1980)
52. 52.
Yao, A.C.-C.: Space-time tradeoff for answering range queries (extended abstract). In: Proceedings of the 14th Annual ACM Symposium on Theory of Computing, STOC 1982, San Francisco, California, USA, 5–7 May 1982, pp. 128–136, (1982)Google Scholar

## Authors and Affiliations

• Timothy M. Chan
• 1
• Meng He
• 2
• J. Ian Munro
• 1
• Gelin Zhou
• 1
1. 1.David R. Cheriton School of Computer ScienceUniversity of WaterlooWaterlooCanada
2. 2.Faculty of Computer ScienceDalhousie UniversityHalifaxCanada