We study the problem of finding maximal exact matches (MEMs) between a query string $Q$ and a labeled directed acyclic graph (DAG) $G=(V,E,\ell)$ and subsequently co-linearly chaining these matches. We show that it suffices to compute MEMs between node labels and $Q$ (node MEMs) to encode full MEMs. Node MEMs can be computed in linear time and we show how to co-linearly chain them to solve the Longest Common Subsequence (LCS) problem between $Q$ and $G$. Our chaining algorithm is the first to consider a symmetric formulation of the chaining problem in graphs and runs in $O(k^2|V| + |E| + kN\log N)$ time, where $k$ is the width (minimum number of paths covering the nodes) of $G$, and $N$ is the number of node MEMs. We then consider the problem of finding MEMs when the input graph is an indexable elastic founder graph (subclass of labeled DAGs studied by Equi et al., Algorithmica 2022). For arbitrary input graphs, the problem cannot be solved in truly sub-quadratic time under SETH (Equi et al., ICALP 2019). We show that we can report all MEMs between $Q$ and an indexable elastic founder graph in time $O(nH^2 + m + M_\kappa)$, where $n$ is the total length of node labels, $H$ is the maximum number of nodes in a block of the graph, $m = |Q|$, and $M_\kappa$ is the number of MEMs of length at least $\kappa$. The results extend to the indexing problem, where the graph is preprocessed and a set of queries is processed as a batch.
翻译:我们研究在查询字符串$Q$与带标签的有向无环图(DAG) $G=(V,E,\ell)$之间寻找最大精确匹配(MEMs)并随后对这些匹配进行共线性链接的问题。我们证明,通过计算节点标签与$Q$之间的MEMs(节点MEMs)即可编码完整的MEMs。节点MEMs可在线性时间内计算,并展示如何通过共线性链接这些匹配来解决$Q$与$G$之间的最长公共子序列(LCS)问题。我们的链接算法首次考虑了图中链接问题的对称形式,运行时间为$O(k^2|V| + |E| + kN\log N)$,其中$k$为$G$的宽度(覆盖所有节点的最小路径数),$N$为节点MEMs的数量。随后我们研究了当输入图是可索引弹性奠基图(Equi等人于Algorithmica 2022研究的带标签DAG子类)时的MEMs发现问题。对于任意输入图,在SETH假设下该问题无法在真正次二次时间内求解(Equi等人,ICALP 2019)。我们证明,在时间$O(nH^2 + m + M_\kappa)$内可报告$Q$与可索引弹性奠基图之间的所有MEMs,其中$n$为节点标签总长度,$H$为图中一个块的最大节点数,$m = |Q|$,$M_\kappa$为长度至少为$\kappa$的MEMs数量。该结果可扩展到索引问题,即对图进行预处理并将一组查询作为批处理执行。