Algorithm Support for Graph Databases, Done Right
Daan de Graaf, Robert Brijder, Soham Chakraborty, George Fletcher, Bram van de Wall, Nikolay Yakovets
TL;DR
The paper tackles the mismatch between graph storage and graph analytics in databases by proposing GraphAlg, a linear-algebra–based DSL that compiles to relational algebra. It demonstrates tight integration with AvantGraph, enabling cross-optimization between queries and graph algorithms through a unified intermediate representation. The authors introduce novel optimizations—sparsity analysis, loop-invariant code motion, and in-place aggregation—and validate them on standard benchmarks, showing reduced code complexity and strong performance relative to established systems. This work advances the practical deployment of graph analytics inside database engines, enabling scalable, expressive, and unified query-and-analytics workflows.
Abstract
Graph database query languages cannot express algorithms like PageRank, forcing costly data wrangling, while existing solutions such as algorithm libraries, vertex-centric APIs, and recursive CTEs lack the necessary combination of expressiveness, performance, and usability. We present GraphAlg: a domain-specific language for graph algorithms that compiles to relational algebra, enabling seamless integration with query processing pipelines. Built on linear algebra foundations, GraphAlg provides intuitive matrix operations that are amenable to aggressive optimization including sparsity analysis, loop-invariant code motion, and in-place aggregation. Our implementation in AvantGraph demonstrates significant code complexity reduction compared to SQL/Python and Pregel while achieving excellent performance on LDBC Graphalytics benchmarks. GraphAlg establishes that graph databases can serve as unified platforms for both queries and analytics.
