The LCP array is an important tool in stringology, allowing to speed up pattern matching algorithms and enabling compact representations of the suffix tree. Recently, Conte et al. [DCC 2023] and Cotumaccio et al. [SPIRE 2023] extended the definition of this array to Wheeler DFAs and, ultimately, to arbitrary labeled graphs, proving that it can be used to efficiently solve matching statistics queries on the graph's paths. In this paper, we provide the first efficient algorithm building the LCP array of a directed labeled graph with $n$ nodes and $m$ edges labeled over an alphabet of size $\sigma$. After arguing that the natural generalization of a compact-space LCP-construction algorithm by Beller et al. [J. Discrete Algorithms 2013] runs in time $\Omega(n\sigma)$, we present a new algorithm based on dynamic range stabbing building the LCP array in $O(n\log \sigma)$ time and $O(n\log\sigma)$ bits of working space.
翻译:LCP数组是字符串学中的重要工具,能够加速模式匹配算法并实现后缀树的紧凑表示。近期,Conte等人[DCC 2023]和Cotumaccio等人[SPIRE 2023]将该数组的定义扩展至Wheeler确定有限自动机,并最终推广至任意标记图,证明其可用于高效求解图路径上的匹配统计查询。本文提出首个高效算法,用于构建包含$n$个节点、$m$条边且标签取自大小为$\sigma$的字母表的有向标记图的LCP数组。在论证Beller等人[J. Discrete Algorithms 2013]提出的紧凑空间LCP构造算法自然推广形式的时间复杂度为$\Omega(n\sigma)$后,我们提出一种基于动态范围穿刺的新算法,该算法可在$O(n\log \sigma)$时间和$O(n\log\sigma)$比特工作空间内构建LCP数组。