# Order preserving pattern matching on trees and DAGs

**Authors:** Temma Nakamura, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda

arXiv: 1706.00148 · 2017-07-26

## TL;DR

This paper studies order preserving pattern matching on trees and DAGs, providing efficient algorithms for trees and proving NP-completeness for DAGs, advancing understanding of pattern matching in complex graph structures.

## Contribution

It introduces linear-time algorithms for order preserving pattern matching on trees and establishes NP-completeness for DAGs, highlighting the complexity differences.

## Key findings

- Linear-time solution for trees with polynomial alphabet
- Logarithmic factor increase for general ordered alphabet
- NP-completeness of pattern matching on DAGs

## Abstract

The order preserving pattern matching (OPPM) problem is, given a pattern string $p$ and a text string $t$, find all substrings of $t$ which have the same relative orders as $p$. In this paper, we consider two variants of the OPPM problem where a set of text strings is given as a tree or a DAG. We show that the OPPM problem for a single pattern $p$ of length $m$ and a text tree $T$ of size $N$ can be solved in $O(m+N)$ time if the characters of $p$ are drawn from an integer alphabet of polynomial size. The time complexity becomes $O(m \log m + N)$ if the pattern $p$ is over a general ordered alphabet. We then show that the OPPM problem for a single pattern and a text DAG is NP-complete.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1706.00148/full.md

## Figures

3 figures with captions in the complete paper: https://tomesphere.com/paper/1706.00148/full.md

## References

14 references — full list in the complete paper: https://tomesphere.com/paper/1706.00148/full.md

---
Source: https://tomesphere.com/paper/1706.00148