NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Conjunctive Regular Path Queries under Injective Semantics

Diego Figueira, Miguel RomeroPODS 2023

Introduction

In the realm of graph databases, a significant disconnect exists between theoretical foundations and industrial implementation. While standard database theory typically assumes "standard semantics"—where paths are allowed to revisit nodes and edges—real-world systems such as Neo4j and the emerging GQL standard often default to "simple paths" (no repeated nodes) or "trails" (no repeated edges).

This paper, authored by Diego Figueira and Miguel Romero, formalizes and analyzes these "injective semantics" for Conjunctive Regular Path Queries (CRPQs). By bridging this gap, the authors provide a rigorous complexity landscape for the queries that actually power modern graph data engines.

Defining Injective Semantics

To capture the nuances of how graph queries are executed in practice, the authors introduce two distinct interpretations of injectivity:

  1. Atom-injective Semantics: Under this model, each individual path (or "atom") defined in the query must be a simple path (no repeated vertices). However, different paths within the same query are permitted to overlap or share nodes.
  2. Query-injective Semantics: This is a more restrictive model where the entire mapping of the query to the graph must be injective. In this case, no two variables in the query can map to the same node, and paths are prohibited from sharing internal nodes.

These definitions allow for a granular analysis of how different levels of restriction impact the computational feasibility of query evaluation and optimization.

The Complexity Paradox

One of the most striking findings of the paper is the "complexity flip-flop" regarding query containment—the problem of determining if the results of one query will always be a subset of another. In query optimization, containment is a vital tool for rewriting and simplifying queries.

In standard semantics, CRPQ containment is ExpSpace-complete. Intuitively, one might expect that adding constraints (like injectivity) would increase this complexity. However, the authors demonstrate a paradox:

  • Query-injective Semantics: By imposing the most restrictive constraints, the complexity actually drops to PSpace-complete. The authors achieve this by using "abstractions" of expansions to manage the query structure more efficiently.
  • Atom-injective Semantics: Conversely, the middle-ground approach proves to be the most difficult. The authors show that atom-injective semantics are powerful enough to encode the Post Correspondence Problem (PCP). Because this semantics allows paths to overlap just enough to "synchronize" sequences, the containment problem becomes undecidable.

Evaluation and Data Complexity

While containment focuses on optimization, the paper also addresses query evaluation (finding the actual results in a database). Under standard semantics, evaluating a fixed query is relatively efficient (NL-complete). However, under any form of injective semantics, the problem jumps to NP-complete. This shift occurs because finding simple paths is inherently more computationally demanding than finding arbitrary walks, as it requires keeping track of visited nodes to avoid cycles.

Summary of Complexity Results

Problem Standard Semantics Query-Injective Atom-Injective
Evaluation NP-complete NP-complete NP-complete
Containment ExpSpace-complete PSpace-complete Undecidable

Beyond these primary categories, the authors also explore subclasses such as Conjunctive Queries (CQ) and queries with finite languages (CRPQ$^{fin}$), finding that many of these restricted cases remain $\Pi^p_2$-hard or NP-complete.

Methodology

The research utilizes formal proofs and complexity class reductions. To analyze the injective constraints, the authors employ expansions—representing queries as canonical graph structures—and morphism types. The undecidability of the atom-injective case is established through a reduction from the Post Correspondence Problem, demonstrating that even seemingly simple path restrictions can lead to computational universality.

Conclusion and Future Directions

This work provides a complete complexity landscape for CRPQs under injective semantics, highlighting that the choices made by graph database designers have profound theoretical implications.

The authors identify several avenues for future research:

  • Trail Semantics: Extending the analysis to edge-injective (trail) semantics, which is also prevalent in systems like Neo4j.
  • Broader Query Classes: Applying these injective constraints to queries with two-way navigation (inverse steps) or unions of queries.
  • The Boundedness Problem: Determining if a recursive query (using Kleene stars) can be simplified into a non-recursive one under injective constraints.

By formalizing these behaviors, the paper provides the necessary theoretical framework to optimize the next generation of graph query languages.

Summary updated

BibTeX
@inproceedings{figueira2023conjunctive,
  author = {Diego Figueira and Miguel Romero},
  title = {{Conjunctive Regular Path Queries under Injective Semantics}},
  booktitle = {PODS},
  year = {2023},
}
Figure