String Matching in (Block) Graphs: A Full Classification by Walk Length
Abstract
We consider directed graphs in which the nodes are labeled with strings. A walk in such a graph naturally corresponds to the concatenation of the visited nodes' labels. These graphs are widely used in bioinformatics to compactly describe large collections of highly similar genomes. Given such a graph and a pattern of length , we seek a walk whose corresponding string has an occurrence of the pattern. We call this the SMLG problem. Amir et al. [J. Algorithms, 2000] showed that SMLG can be solved in time, where is the total length of all node labels. Equi et al. [ACM Trans. Algorithms, 2023] showed that this is essentially optimal (under SETH). The existing lower bound assumes that the sought walk is of length . Thus, we might be able to bypass this lower bound by restricting the walk length to , which naturally reduces to having as input a directed graph whose set of nodes is partitioned into blocks. Then, we seek a walk in this graph that starts in the first block and ends in the last block. We call this the -SMBG problem. We provide a more fine-grained classification that essentially settles the complexity of -SMBG parameterized by : (1) We give a near-linear-time algorithm for . (2) We show that there is no combinatorial algorithm improving over the state-of-the-art bound for any . (3) We also present a fast matrix multiplication-based algorithm yielding an improvement for , which is conditionally optimal. (4) Finally, we show that under SETH, for any , no algorithm can improve over the state of the art.
Cite
@article{arxiv.2607.28159,
title = {String Matching in (Block) Graphs: A Full Classification by Walk Length},
author = {Sebastian Angrick and Ben Bals and Paweł Gawrychowski and Solon P. Pissis and Yuki Yonemoto},
journal= {arXiv preprint arXiv:2607.28159},
year = {2026}
}
Comments
ESA 2026