The problem of String Matching to Labeled Graphs (SMLG) asks to find all the paths in a labeled graph $G = (V, E)$ whose spellings match that of an input string $S \in \Sigma^m$. SMLG can be solved in quadratic $O(m|E|)$ time [Amir et al., JALG], which was proven to be optimal by a recent lower bound conditioned on SETH [Equi et al., ICALP 2019]. The lower bound states that no strongly subquadratic time algorithm exists, even if restricted to directed acyclic graphs (DAGs). In this work we present the first parameterized algorithms for SMLG in DAGs. Our parameters capture the topological structure of $G$. All our results are derived from a generalization of the Knuth-Morris-Pratt algorithm [Park and Kim, CPM 1995] optimized to work in time proportional to the number of prefix-incomparable matches. To obtain the parameterization in the topological structure of $G$, we first study a special class of DAGs called funnels [Millani et al., JCO] and generalize them to $k$-funnels and the class $ST_k$. We present several novel characterizations and algorithmic contributions on both funnels and their generalizations.
翻译:字符串与标记图匹配(SMLG)问题要求找出标记图 $G = (V, E)$ 中所有拼写与输入字符串 $S \in \Sigma^m$ 相匹配的路径。SMLG 可在 $O(m|E|)$ 二次时间内求解 [Amir 等,JALG],而最近基于 SETH 的下界 [Equi 等,ICALP 2019] 证明该时间复杂度是最优的。该下界指出,即使限制在无环有向图(DAG)上,也不存在强次二次时间算法。本文首次提出了 DAG 上 SMLG 的参数化算法。我们的参数捕捉了 $G$ 的拓扑结构。所有结果均源于对 Knuth-Morris-Pratt 算法 [Park 和 Kim,CPM 1995] 的推广,该算法经过优化,其运行时间与前缀不可比较匹配的数量成正比。为了获得基于 $G$ 拓扑结构的参数化,我们首先研究了一类名为漏斗(funnel)的特殊 DAG [Millani 等,JCO],并将其推广至 $k$-漏斗及 $ST_k$ 类结构。我们对漏斗及其推广提出了若干新的特征刻画与算法贡献。