We consider the problem of constructing strings over an alphabet Σ that start with a given prefix u, end with a given suffix v, and avoid occurrences of a given set of forbidden substrings. In the decision version of the problem, given a set Sk of forbidden substrings, each of length k, over Σ, we are asked to decide whether there exists a string x over Σ such that u is a prefix of x, v is a suffix of x, and no s ϵ Sk occurs in x. Our first result is an O(|u| + |v| + k|Sk|)-time algorithm to decide this problem. In the more general optimization version of the problem, given a set S of forbidden arbitrary-length substrings over Σ, we are asked to construct a shortest string x over S such that u is a prefix of x, v is a suffix of x, and no s ϵ S occurs in x. Our second result is an O(|u| + |v| + ||S|| · |Σ|)-time algorithm to solve this problem, where ||S|| denotes the total length of the elements of S. Interestingly, our results can be directly applied to solve the reachability and shortest path problems in complete de Bruijn graphs in the presence of forbidden edges or of forbidden paths. Our algorithms are motivated by data privacy, and in particular, by the data sanitization process. In the context of strings, sanitization consists in hiding forbidden substrings from a given string by introducing the least amount of spurious information. We consider the following problem. Given a string w of length n over Σ, an integer k, and a set Sk of forbidden substrings, each of length k, over Σ, construct a shortest string y over Σ such that no s ϵ Sk occurs in y and the sequence of all other length-k fragments occurring in w is a subsequence of the sequence of the length-k fragments occurring in y. Our third result is an O(nk|Sk| · |Σ|)-time algorithm to solve this problem.

, , ,
doi.org/10.4230/LIPIcs.CPM.2021.9
Leibniz International Proceedings in Informatics
Networks
32nd Annual Symposium on Combinatorial Pattern Matching, CPM 2021
Centrum Wiskunde & Informatica, Amsterdam (CWI), The Netherlands

Bernardini, G, Marchetti Spaccamela, A, Pissis, S, Stougie, L, & Sweering, M.J.M. (2021). Constructing strings avoiding forbidden substrings. In Proceedings of the 32nd Annual Symposium on Combinatorial Pattern Matching CPM 2021 (pp. 9.1–9.18). doi:10.4230/LIPIcs.CPM.2021.9