Abstract
The all-pairs suffix-prefix (APSP) problem is a classical problem in string processing which has important applications in bioinformatics. Given a set \(\mathcal {S} = \{S_1, \ldots , S_k\}\) of k strings, the APSP problem asks one to compute the longest suffix of \(S_i\) that is a prefix of \(S_j\) for all \(k^2\) ordered pairs \(\langle S_i, S_j \rangle \) of strings in \(\mathcal {S}\). In this paper, we consider the dynamic version of the APSP problem that allows for insertions of new strings to the set of strings. Our objective is, each time a new string \(S_i\) arrives to the current set \(\mathcal {S}_{i-1} = \{S_1, \ldots , S_{i-1}\}\) of \(i-1\) strings, to compute (1) the longest suffix of \(S_i\) that is a prefix of \(S_j\) and (2) the longest prefix of \(S_i\) that is a suffix of \(S_j\) for all \(1 \le j \le i\). We propose an O(n)-space data structure which computes (1) and (2) in \(O(|S_i| \log \sigma + i)\) time for each new given string \(S_i\), where n is the total length of the strings.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
We do not use the output function in our algorithms.
References
Abouelhoda, M.I., Kurtz, S., Ohlebusch, E.: Replacing suffix trees with enhanced suffix arrays. J. Discrete Algorithms 2(1), 53–86 (2004)
Aho, A.V., Corasick, M.J.: Efficient string matching: an aid to bibliographic search. Commun. ACM 18, 333–340 (1975)
Alstrup, S., Holm, J., de Lichtenberg, K., Thorup, M.: Minimizing diameters of dynamic trees. In: Degano, P., Gorrieri, R., Marchetti-Spaccamela, A. (eds.) ICALP 1997. LNCS, vol. 1256, pp. 270–280. Springer, Heidelberg (1997). https://doi.org/10.1007/3-540-63165-8_184
Blumer, A., Blumer, J., Haussler, D., Ehrenfeucht, A., Chen, M.T., Seiferas, J.I.: The smallest automaton recognizing the subwords of a text. Theoret. Comput. Sci. 40, 31–55 (1985)
Blumer, A., Blumer, J., Haussler, D., McConnell, R., Ehrenfeucht, A.: Complete inverted files for efficient text retrieval and analysis. J. ACM 34(3), 578–595 (1987). https://doi.org/10.1145/28869.28873
Cánovas, R., Cazaux, B., Rivals, E.: The compressed overlap index. CoRR arXiv:1707.05613 (2017)
Dori, S., Landau, G.M.: Construction of Aho Corasick automaton in linear time for integer alphabets. Inf. Process. Lett. 98(2), 66–72 (2006)
Farach-Colton, M., Ferragina, P., Muthukrishnan, S.: On the sorting-complexity of suffix tree construction. J. ACM 47(6), 987–1011 (2000)
Gusfield, D.: Algorithms on Strings, Trees, and Sequences - Computer Science and Computational Biology. Cambridge University Press (1997)
Gusfield, D., Landau, G.M., Schieber, B.: An efficient algorithm for the all pairs suffix-prefix problem. Inf. Process. Lett. 41(4), 181–185 (1992)
Hendrian, D., Inenaga, S., Yoshinaka, R., Shinohara, A.: Efficient dynamic dictionary matching with DAWGs and AC-automata. Theor. Comput. Sci. 792, 161–172 (2019)
Khan, S.: Optimal construction of hierarchical overlap graphs. In: CPM 2021. LIPIcs, vol. 191, pp. 17:1–17:11 (2021)
Knuth, D.E., Morris, J.H., Jr., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)
Lim, J., Park, K.: A fast algorithm for the all-pairs suffix-prefix problem. Theor. Comput. Sci. 698, 14–24 (2017)
Loukides, G., Pissis, S.P.: All-pairs suffix/prefix in optimal time using Aho-Corasick space. Inf. Process. Lett. 178, 106275 (2022)
Loukides, G., Pissis, S.P., Thankachan, S.V., Zuba, W.: Suffix-prefix queries on a dictionary. In: CPM 2023. LIPIcs, vol. 259, pp. 21:1–21:20 (2023)
Manber, U., Myers, E.W.: Suffix arrays: a new method for on-line string searches. SIAM J. Comput. 22(5), 935–948 (1993)
Ohlebusch, E., Gog, S.: Efficient algorithms for the all-pairs suffix-prefix problem and the all-pairs substring-prefix problem. Inf. Process. Lett. 110(3), 123–128 (2010)
Park, S., Park, S.G., Cazaux, B., Park, K., Rivals, E.: A linear time algorithm for constructing hierarchical overlap graphs. In: CPM 2021. LIPIcs, vol. 191, pp. 22:1–22:9 (2021)
Takagi, T., Inenaga, S., Arimura, H., Breslauer, D., Hendrian, D.: Fully-online suffix tree and directed acyclic word graph construction for multiple texts. Algorithmica 82(5), 1346–1377 (2020)
Tustumi, W.H.A., Gog, S., Telles, G.P., Louza, F.A.: An improved algorithm for the all-pairs suffix-prefix problem. J. Discrete Algorithms 37, 34–43 (2016)
Weiner, P.: Linear pattern matching algorithms. In: 14th Annual Symposium on Switching and Automata Theory, pp. 1–11 (1973)
Westbrook, J.R.: Fast incremental planarity testing. In: ICALP 1992. Lecture Notes in Computer Science, vol. 623, pp. 342–353 (1992)
Acknowledgments
This work was supported by JSPS KAKENHI Grant Numbers and JP20H05964, JP23K24808, JP23K18466 (SI).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Kikuchi, M., Inenaga, S. (2025). All-Pairs Suffix-Prefix on Dynamic Set of Strings. In: Lipták, Z., Moura, E., Figueroa, K., Baeza-Yates, R. (eds) String Processing and Information Retrieval. SPIRE 2024. Lecture Notes in Computer Science, vol 14899. Springer, Cham. https://doi.org/10.1007/978-3-031-72200-4_15
Download citation
DOI: https://doi.org/10.1007/978-3-031-72200-4_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-72199-1
Online ISBN: 978-3-031-72200-4
eBook Packages: Computer ScienceComputer Science (R0)