TL;DR
This paper introduces Temporal Regular Path Queries (TRPQs), a syntax extension for graph query languages that enables seamless navigation across both graph topology and time. The authors establish the theoretical complexity of evaluating these queries and demonstrate that a practical, parallelized implementation in Rust can process complex temporal queries over millions of edges in seconds.
What Problem Does This Paper Address?
Graph databases are excellent at handling highly connected data, but real-world networks aren't static—they evolve. Whether you are tracking financial transactions, analyzing social networks, or performing contact tracing for a disease, nodes and edges change their attributes or existence over time.
While standard graph query languages like Cypher or PGQL excel at structural navigation, they lack native, elegant support for temporal paths. Existing workarounds either rely on clunky custom functions or suffer from unstudied, often intractable evaluation complexities. This paper bridges the gap by proposing a clean, standardized temporal extension to the familiar MATCH clause, backed by a rigorous foundational framework.
Methods
The authors formalize two ways to represent a Temporal Property Graph (TPG):
- Point-based TPGs: Where graph snapshots are mapped to discrete time points.
- Interval-timestamped TPGs (ITPGs): A more compact representation where elements are annotated with valid time intervals (e.g.,
[start, end]).
They introduce a formal query language called NavL[PC, NOI] that extends standard regular path queries with temporal operators (PREV, NEXT) and structural operators (FWD, BWD). Crucially, the language enforces navigation orthogonality, meaning structural moves (moving across edges) and temporal moves (moving through time) are decoupled.
On the implementation side, the authors built a multi-threaded dataflow evaluator in Rust using the Itertools and Rayon-Rs libraries. The evaluation pipeline breaks down queries into three distinct steps:
- Evaluating structural navigation over the interval-based graph using optimized select-project-join plans.
- Applying interval-based temporal reasoning to prune invalid matches.
- Expanding results into a point-wise representation only when required by fine-grained temporal constraints.
Datasets
The framework was evaluated using synthetic interval-timestamped TPGs modeled after a real-world COVID-19 contact tracing scenario on a university campus (originally sourced from Ojagh et al.).
The authors scaled this data up to create ten different benchmark graphs ($G_1$ to $G_{10}$). The largest graph, $G_{10}$, contains:
- 100,000 unique Person nodes (340,000 temporal nodes)
- 100 unique Room nodes
- Over 32 million temporal edges spanning a temporal domain of 48 five-minute windows.
Key Insights and Ideas
- The Orthogonality Advantage: By keeping temporal and structural navigation operators strictly independent, the authors avoid the combinatorial explosion that typically plagues temporal path queries. This design choice directly enables their decoupled, step-by-step execution strategy.
- Point vs. Interval Complexity Trade-off: Evaluating queries on point-stamped graphs runs in polynomial time. However, doing so on compact, interval-stamped graphs can skyrocket to PSPACE-complete if arbitrary numerical repetitions (like checking if an event happened exactly $N$ times) are allowed.
- Identifying the Sweet Spot: The authors identified a significant fragment of the language (
NavL[PC]) that disallows these strict numerical occurrence indicators but retains path conditions. This fragment can be evaluated in polynomial time even over compact interval-stamped graphs, providing the perfect foundation for a production-ready engine.
Key Results
The Rust-based implementation proved to be highly efficient on the massive 32-million-edge $G_{10}$ dataset:
- Sub-second Execution: The majority of the 12 benchmark queries ($Q_1$ through $Q_{10}$) executed in less than one second.
- Handling Massive Outputs: The most demanding queries ($Q_{11}$ and $Q_{12}$), which involved complex combinations of structural visits and temporal shifts, generated over 26 million output tuples in just 4.9 to 6.4 seconds.
- Excellent Scalability: The execution time scaled linearly with graph size for most queries, and quadratically only when the underlying output size grew quadratically. Furthermore, the system showed strong parallelization benefits, performing optimally when scaled up to 16 CPU cores.
Limitations and Future Work
While the proposed framework is highly performant, the authors note a few areas for future development:
- Lack of Aggregations: The current language fragment does not support aggregation and grouping operations (e.g., counting the number of times a contact occurred within a window).
- Database Integration: The current implementation is a standalone prototype in Rust. Integrating these methods directly into existing mainstream graph processing systems like Neo4j, Apache Spark (GraphX), or Portal remains an open engineering challenge.
- Alternative Timestamping: Future work will explore how different object timestamping and temporal coalescing strategies impact query performance.
Summary updated