This paper proposes a framework to formally link a fragment of an algebraic language to a Graph Neural Network (GNN). It relies on Context Free Grammars (CFG) to organise algebraic operations into generative rules that can be translated into a GNN layer model. Since the rules and variables of a CFG directly derived from a language contain redundancies, a grammar reduction scheme is presented making tractable the translation into a GNN layer. Applying this strategy, a grammar compliant with the third-order Weisfeiler-Lehman (3-WL) test is defined from MATLANG. From this 3-WL CFG, we derive a provably 3-WL GNN model called G$^2$N$^2$. Moreover, this grammatical approach allows us to provide algebraic formulas to count the cycles of length up to six and chordal cycles at the edge level, which enlightens the counting power of 3-WL. Several experiments illustrate that G$^2$N$^2$ efficiently outperforms other 3-WL GNNs on many downstream tasks.
翻译:本文提出一个框架,将代数语言的一个片段与图神经网络(GNN)进行形式化关联。该框架利用上下文无关文法(CFG)将代数操作组织为生成规则,这些规则可转化为GNN层模型。由于直接从语言导出的CFG规则和变量存在冗余,我们提出一种语法简化方案,使转化为GNN层的操作变得可行。应用该策略,基于MATLANG定义了一个符合三阶Weisfeiler-Lehman(3-WL)测试的文法。从该3-WL CFG出发,我们推导出一个可证明为3-WL的GNN模型,称为G$^2$N$^2$。此外,这种语法化方法使我们能够提供代数公式,在边级别上计算长度不超过六的环和弦环,从而阐明3-WL的计数能力。多项实验表明,G$^2$N$^2$在多项下游任务上高效地优于其他3-WL GNN模型。