String Matching in (Block) Graphs: A Full Classification by Walk Length

📅 2026-07-30
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the problem of string-labeled path matching in directed graphs (b-SMBG), which seeks a path traversing at most $b$ blocks whose concatenated edge labels contain a given pattern. Leveraging fine-grained complexity analysis, combinatorial algorithm design, and fast matrix multiplication techniques under the Strong Exponential Time Hypothesis (SETH), the work provides the first complete characterization of the problem’s complexity landscape across different values of $b$. Specifically, it presents a near-linear time algorithm for $b = 3$, establishes that combinatorial algorithms cannot surpass the classic bound for $b \geq 4$, yields conditionally optimal matrix-multiplication-based algorithms for constant $b$, and proves that the classic bound is unbreakable when $b \in \omega(\log |V|)$.
📝 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 $G=(V,E)$ and a pattern of length $m$, 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 $\mathcal{O}(m|E| + N)$ time, where $N$ 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 $Θ(|V|)$. Thus, we might be able to bypass this lower bound by restricting the walk length to $b-1$, which naturally reduces to having as input a directed graph whose set of nodes is partitioned into $b$ 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 $b$-SMBG problem. We provide a more fine-grained classification that essentially settles the complexity of $b$-SMBG parameterized by $b$: (1) We give a near-linear-time algorithm for $b=3$. (2) We show that there is no combinatorial algorithm improving over the state-of-the-art $\mathcal{O}(m|E| + N)$ bound for any $b\ge 4$. (3) We also present a fast matrix multiplication-based algorithm yielding an improvement for $b \in \mathcal{O}(1)$, which is conditionally optimal. (4) Finally, we show that under SETH, for any $b \in ω(\log |V|)$, no algorithm can improve over the state of the art.
Problem

Research questions and friction points this paper is trying to address.

string matching
block graphs
walk length
SMLG
b-SMBG
Innovation

Methods, ideas, or system contributions that make the work stand out.

string matching in graphs
block graphs
walk length parameterization
fine-grained complexity
conditional lower bounds
🔎 Similar Papers
No similar papers found.