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

Graph Logics with Rational Relations

Pablo Barceló, Diego Figueira, Leonid Libkin

TL;DR

This research explores the computational boundaries of querying graph databases when comparing paths using complex relationships like "subword" or "subsequence." While many such comparisons lead to undecidability, the authors identify "acyclic query patterns" as a critical sweet spot that allows for efficient evaluation even with complex path relations.

Introduction: Beyond Simple Connectivity

Graph databases serve as the foundation for modern social networks, biological models, and the Semantic Web (RDF). To extract meaningful information, researchers use Graph Logics. Standard logics, such as Conjunctive Regular Path Queries (CRPQs), allow us to find nodes connected by paths matching specific patterns, typically defined as regular languages.

However, real-world applications often demand more than simple pattern matching; they require comparing two different paths. For instance, in a biological network, a researcher might need to find two protein sequences where one is a subsequence of another. In the Semantic Web, one might look for paths where one string is a subword of another. These comparisons are known as rational relations. Unlike "regular relations" where scanners move over words in sync, rational relations allow for asynchronous movement, making them significantly more powerful—and computationally dangerous.

The Core Challenge: The Generalized Intersection Problem

The central question of this paper is whether we can add these powerful path comparisons to graph logics without making queries impossible to compute. To answer this, the authors translate query evaluation into what they term the Generalized Intersection Problem.

The Generalized Intersection Problem, the core formal challenge addressed in the research.

In this framework, the goal is to determine if there exists any pair of paths that satisfies both a set of regular constraints (the graph structure) and a specific comparison rule (the rational relation). If this intersection is empty, the query has no results; if it is non-empty, a match exists.

Methodology

To map the complexity landscape of these queries, the authors employed several theoretical tools:

  • Automata Theory: Path relations were represented using $n$-tape automata, where different "heads" read different words at varying speeds.
  • Reductions for Undecidability: To prove certain queries are uncomputable, the authors demonstrated how to encode the behavior of a Linear Bounded Automaton (LBA) or the Post Correspondence Problem (PCP) into the query. Solving such a query would be equivalent to solving the Halting Problem.
  • Well-Quasi-Orders: For the "subsequence" relation, the authors utilized Higman’s Lemma to prove decidability, even though the resulting complexity is extremely high.
  • Syntactic Analysis: They introduced the concept of acyclicity in query patterns—restricting the "shape" of how paths are compared to avoid the logical loops that typically lead to undecidability.

Key Insights: Rigidity vs. Flexibility

The research highlights a fundamental dichotomy in path relations:

  1. The "Rigidity" Trap: Relations like subword and suffix are "rigid," meaning they strictly preserve the relative positions of characters. This rigidity allows a query to simulate the tape of a Turing machine, leading directly to undecidability when combined with regular path constraints.
  2. The "Flexibility" of Subsequences: The subsequence relation is more "flexible." Because characters can be skipped, it is much harder to build a rigid simulation of a computer tape. This makes subsequence comparisons decidable, though they remain "non-multiply-recursive" (growing faster than any standard exponential function).
  3. The Acyclicity Breakthrough: The most significant discovery is that the structure of the comparison matters as much as the relation itself. If the graph of path comparisons is a tree (acyclic), the complexity drops dramatically to PSpace, which is manageable for complex queries. If the comparison pattern contains a cycle, the problem often becomes undecidable.

Results and Complexity Map

The paper provides a definitive classification of query complexity:

  • Undecidable: Combining regular relations with subword or suffix comparisons in general query structures.
  • Decidable but Infeasible: Combining regular relations with subsequence comparisons (Non-multiply-recursive complexity).
  • Efficient (Tractable): Evaluation of Acyclic CRPQs with any rational relation is PSpace-complete for combined complexity and NLogSpace-complete for data complexity. This suggests that for a fixed query, searching a large database remains highly efficient.

Future Directions

While this work provides a robust map of the logic landscape, several gaps remain. The authors note that the complexity of combining subwords with simpler "recognizable" relations is still an open question. Furthermore, extending these results to infinite alphabets—which would allow for the inclusion of real-world data values like timestamps or unique IDs—is a natural next step for the field.

Summary updated

BibTeX
@inproceedings{barcelo2013graph,
  author = {Pablo Barceló and Diego Figueira and Leonid Libkin},
  title = {{Graph Logics with Rational Relations}},
  booktitle = {Log. Methods Comput. Sci},
  year = {2013},
  url = {https://openreview.net/forum?id=fffW6tQNuC},
}
Figure