Skip to main content
QUICK REVIEW

[Paper Review] On the Complexity of Exact Pattern Matching in Graphs: Determinism and Zig-Zag Matching

Massimo Equi, Roberto Grossi|arXiv (Cornell University)|Feb 10, 2019
Algorithms and Data CompressionComputer Science5 references5 citations
TL;DR

This paper establishes a conditional lower bound for exact pattern matching in labeled graphs, proving that the problem cannot be solved in subquadratic time under the Orthogonal Vectors Hypothesis (OV), even in restricted cases such as undirected graphs of maximum degree two (zig-zag matching) and deterministic directed acyclic graphs. The result extends prior work under the Strong Exponential Time Hypothesis (SETH), showing that the $O(|E|m)$ barrier remains unavoidable in these settings.

ABSTRACT

Exact pattern matching in labeled graphs is the problem of searching paths of a graph $G=(V,E)$ that spell the same string as the given pattern $P[1..m]$. This basic problem can be found at the heart of more complex operations on variation graphs in computational biology, query operations in graph databases, and analysis of heterogeneous networks, where the nodes of some paths must match a sequence of labels or types. In our recent work we described a conditional lower bound stating that the exact pattern matching problem in labeled graphs cannot be solved in less than quadratic time, namely, $O(|E|^{1 - ε} \, m)$ time or $O(|E| \, m^{1 - ε})$ time for any constant $ε>0$, unless the Strong Exponential Time Hypothesis (SETH) is false. The result holds even if node labels and pattern $P$ are drawn from a binary alphabet, and $G$ is restricted to undirected graphs of maximum degree three or directed acyclic graphs of maximum sum of indegree and outdegree three. It was left open what happens on undirected graphs of maximum degree two, i.e., when the pattern can have a zig-zag match in a (cyclic) bidirectional string. Also, the reduction created a non-determistic directed acyclic graph, and it was left open if determinism would make the problem easier. In this work, we show through the Orthogonal Vectors hypothesis (OV) that the same conditional lower bound holds even for these restricted cases.

Motivation & Objective

  • To close gaps in the complexity understanding of exact pattern matching in labeled graphs by analyzing restricted cases left open by prior work.
  • To investigate whether determinism or structural restrictions (e.g., maximum degree two) reduce the complexity of pattern matching in labeled graphs.
  • To extend the conditional lower bound from the Strong Exponential Time Hypothesis (SETH) to the Orthogonal Vectors Hypothesis (OV) for these restricted graph classes.
  • To prove that the $O(|E|m)$ time bound remains optimal under OV for zig-zag matching in bidirectional strings and deterministic DAGs.

Proposed method

  • Construct a reduction from the Orthogonal Vectors (OV) problem to the exact pattern matching problem in labeled graphs.
  • Design a graph structure $LG$ composed of specialized subgraphs $LG_{U}^{(j)}$, $LG_{W}^{(j)}$, and $LG_{D}^{(j)}$ to encode vector components and their dot product.
  • Use labeled nodes with string labels to simulate vector orthogonality checks: a match in $LG_{W}^{(j)}$ corresponds to a zero dot product between vectors.
  • Introduce two modified patterns $P^{(1)}$ and $P^{(2)}$ to ensure that every sub-pattern of the pattern can be tested for a match in the central $LG_{W}^{(j)}$ component.
  • Leverage the fact that only sub-patterns in even positions can match $LG_{W}^{(j)}$, and use pattern swapping to cover all positions.
  • Prove equivalence: $P^{(1)}$ or $P^{(2)}$ has a match in $LG$ if and only if there exist orthogonal vectors in $X$ and $Y$.

Experimental results

Research questions

  • RQ1Can the $O(|E|m)$ time bound for exact pattern matching in labeled graphs be broken in undirected graphs of maximum degree two, where zig-zag matching is possible?
  • RQ2Does determinism in directed acyclic graphs (DAGs) reduce the complexity of exact pattern matching compared to non-deterministic DAGs?
  • RQ3Is the conditional lower bound under SETH also valid under the weaker Orthogonal Vectors Hypothesis (OV) for restricted graph classes?
  • RQ4Can the reduction technique used for general graphs be adapted to preserve hardness in structural subclasses like degree-two undirected graphs and deterministic DAGs?

Key findings

  • The exact pattern matching problem in labeled graphs cannot be solved in $O(|E|^{1- ho}m)$ or $O(|E|m^{1- ho})$ time for any $\rho > 0$ under the Orthogonal Vectors Hypothesis (OV), even in undirected graphs of maximum degree two.
  • The same conditional lower bound holds for deterministic directed acyclic graphs (DAGs), showing that determinism does not make the problem easier in this context.
  • The reduction constructs a graph where a pattern matches if and only if two vectors from input sets are orthogonal, preserving the orthogonality decision problem.
  • The use of two modified patterns $P^{(1)}$ and $P^{(2)}$ ensures that every sub-pattern can be tested for a match in the central $LG_{W}^{(j)}$ component, regardless of position.
  • The construction is robust even when the number of sub-patterns is odd, by adding a dummy sub-pattern that does not disrupt the reduction.
  • The result confirms that the $O(|E|m)$ time bound is essentially optimal for exact pattern matching in labeled graphs under standard complexity assumptions, even in highly restricted graph classes.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.