Abstract
Graph-structured data ubiquitously appears in science and engineering. Graph neural networks (GNNs) are designed to exploit the relational inductive bias exhibited in graphs; they have been shown to outperform other forms of neural networks in scenarios where structure information supplements node features. The most common GNN architecture aggregates information from neighborhoods based on message passing. Its generality has made it broadly applicable. In this paper, we focus on a special, yet widely used, type of graphs — DAGs — and inject a stronger inductive bias — partial ordering — into the neural network design. We propose the directed acyclic graph neural network (DAGNN), an architecture that processes information according to the flow defined by the partial order. DAGNN can be considered a framework that entails earlier works as special cases, but we identify several crucial components that prior architectures lack. We perform comprehensive experiments on representative DAG datasets (source code, neural architectures, and probabilistic graphical models) and demonstrate the superiority of DAGNN over simpler DAG architectures as well as general graph architectures.
Introduction
Most popular Graph Neural Networks (GNNs) rely on Message Passing Neural Networks (MPNNs). These models update node representations by aggregating information from a node's immediate neighborhood. While versatile, MPNNs have a major limitation: a node's "view" of the graph is restricted by the number of layers ($L$). To see information $L+1$ hops away, you need $L+1$ layers.
However, many real-world graphs are Directed Acyclic Graphs (DAGs), which possess a natural "flow" or partial ordering. For example, a line of source code depends on variables defined previously. Standard MPNNs ignore this flow, treating the graph as a collection of local neighborhoods. We argue that for DAGs, we should inject a stronger inductive bias: the neural network should process information sequentially according to the graph's partial order, allowing "sink" nodes to digest information from the entire graph regardless of the network's depth.
The DAGNN Architecture
The core innovation of DAGNN is how it handles information flow within the neural layers. Unlike standard GNNs that use information from the previous layer ($\ell-1$) to update the current layer ($\ell$), DAGNN updates a node using the representations of its predecessors in the same layer.
As shown in the architecture diagram, the model employs three key components:
- Attention-Based Aggregation: It uses a query-key attention mechanism. A node's representation from the previous layer acts as a "query" to determine which of its predecessors' current-layer "messages" are most relevant.
- Recurrent Combination: It employs a Gated Recurrent Unit (GRU) to combine the aggregated message with the node's previous state, effectively "tracking" the processed part of the graph.
- Target-Centric Readout: Since information flows toward nodes without successors (targets), the final graph representation is pooled specifically from these "sink" nodes, which naturally accumulate the "summary" of the entire graph.
Parallelization via Topological Batching
To solve the bottleneck of sequential processing, we utilize "topological batching." We group nodes into independent sets (batches) that can be processed in parallel without violating the partial order.
In this scheme, nodes in $B_0$ are processed first, followed by $B_1$, and so on. Nodes within the same batch have no dependencies on each other and can be computed simultaneously. We provide a theoretical proof that this method yields maximal parallel concurrency, making DAGNN's training time comparable to other specialized DAG models.
Experimental Evaluation
We evaluated DAGNN across three distinct domains:
- Source Code (OGBG-CODE): A massive dataset of Python functions. DAGNN achieved an F1 score of 34.41, outperforming the best MPNN (GAT at 33.59) and previous state-of-the-art DAG models.
- Neural Architectures (NA): Predicting performance on CIFAR-10. DAGNN achieved an RMSE of 0.264, a massive improvement over the previous D-VAE model (0.375).
- Bayesian Networks (BN): Predicting the Bayesian Information Criterion (BIC) score.
A striking result occurred in the Longest Path (LP) task, where DAGNN achieved near-perfect accuracy (99.93%) while standard GNNs struggled. This is because the sequential flow of DAGNN perfectly mimics the path-tracing logic required to solve the problem.
Conclusion
DAGNN demonstrates that aligning a model's inductive bias with the underlying logic of the data—in this case, the partial ordering of DAGs—leads to significantly more discriminative representations. By using current-layer information and topological batching, DAGNN ensures information "freshness" and computational efficiency, outperforming both general-purpose GNNs and earlier DAG-specific architectures.
Summary updated