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.
翻译:图数据库查询语言无法表达诸如PageRank等算法,导致需要耗费大量精力进行数据预处理,而现有解决方案(如算法库、顶点中心API和递归CTE)均未能兼顾表达能力、性能与易用性。本文提出GraphAlg:一种专用于图算法的领域特定语言,其可编译为关系代数,从而实现与查询处理流程的无缝集成。基于线性代数基础构建的GraphAlg提供直观的矩阵运算,适用于稀疏性分析、循环不变量外提及原位聚合等深度优化。我们在AvantGraph系统中的实现表明,相较于SQL/Python和Pregel方案,GraphAlg能显著降低代码复杂度,同时在LDBC Graphalytics基准测试中展现出卓越性能。GraphAlg证实了图数据库可作为查询与分析一体化的统一平台。