DLGNet: Hyperedge Classification through Directed Line Graphs for Chemical Reactions

Stefano Fiorini, Giulia M. Bovolenta, Stefano Coniglio, Michele Ciavotta, Pietro Morerio, Michele Parrinello, Alessio Del Bue

Abstract

Graphs and hypergraphs provide powerful abstractions for modeling interactions among a set of entities of interest and have been attracting a growing interest in the literature thanks to many successful applications in several fields. In particular, they are rapidly expanding in domains such as chemistry and biology, especially in the areas of drug discovery and molecule generation. One of the areas witnessing the fasted growth is the chemical reactions field, where chemical reactions can be naturally encoded as directed hyperedges of a hypergraph. In this paper, we address the chemical reaction classification problem by introducing the notation of a Directed Line Graph (DGL) associated with a given directed hypergraph. On top of it, we build the Directed Line Graph Network (DLGNet), the first spectral-based Graph Neural Network (GNN) expressly designed to operate on a hypergraph via its DLG transformation. The foundation of DLGNet is a novel Hermitian matrix, the Directed Line Graph Laplacian, which compactly encodes the directionality of the interactions taking place within the directed hyperedges of the hypergraph thanks to the DLG representation. The Directed Line Graph Laplacian enjoys many desirable properties, including admitting an eigenvalue decomposition and being positive semidefinite, which make it well-suited for its adoption within a spectral-based GNN. Through extensive experiments on chemical reaction datasets, we show that DGLNet significantly outperforms the existing approaches, achieving on a collection of real-world datasets an average relative-percentage-difference improvement of 33.01%, with a maximum improvement of 37.71%.

Introduction

In computational chemistry, modeling reactions is a complex balancing act. A reaction is not merely a link between two molecules; it typically involves multiple reactants (heads) transforming into multiple products (tails). While hypergraphs are effective at modeling these group-wise interactions, most existing Hypergraph Neural Networks (HNNs) treat relationships as undirected. This lack of directionality is a significant limitation in chemistry, where the distinction between reactants and products is fundamental. Furthermore, most HNNs focus on node classification, whereas the critical challenge in reaction engineering is classifying the reaction itself—the hyperedge.

Methodology: The Directed Line Graph Transformation

To address these challenges, we introduce DLGNet, a framework that utilizes a two-step transformation to preserve directional information:

  1. Directed Line Graph (DLG) Transformation: The directed hypergraph is transformed into a Line Graph where each node represents a reaction (a hyperedge from the original graph). Connections between these new nodes exist if their corresponding reactions share a molecule.
  2. Hermitian Directed Line Graph Laplacian ($\vec{L}_N$): To handle directionality, we utilize the complex plane. We define a novel Laplacian matrix where real components encode undirected adjacency and imaginary components ($i$ and $-i$) encode the "flow" of molecules (e.g., whether a molecule acts as a product in one reaction and a reactant in another).
Transformation of a directed hypergraph into a Directed Line Graph (DLG) with complex-valued weights.

This Hermitian matrix is positive semidefinite, ensuring the mathematical stability required for spectral convolutions. DLGNet is the first spectral GNN designed to convolve hyperedge features directly, allowing the model to learn the context of chemical transformations within larger pathways.

Experimental Setup and Datasets

DLGNet was evaluated on three real-world chemical reaction datasets representing varying levels of complexity:

  • Dataset-1 (USPTO): 50,000 atom-mapped reactions from U.S. patents across 10 common organic chemistry classes.
  • Dataset-2 (Mixed Sources): 5,300 reactions including catalysts, solvents, and bases, providing a more realistic and "messy" environment.
  • Dataset-3 (SN2 vs. E2): A specialized dataset of 649 reactions focused on the difficult task of distinguishing between bimolecular substitution and elimination pathways.
Overview of the three chemical reaction datasets used for evaluation, ranging from patent data to specialized mechanistic pathways.

Results and Discussion

DLGNet significantly outperformed 12 state-of-the-art baselines, including both undirected and directed HNNs. Across all datasets, the model achieved an average Relative Percentage Difference (RPD) improvement of 33.01% over the second-best method. Notably, on the highly competitive SN2/E2 dataset, DLGNet achieved a near-perfect 99.75% F1-score, whereas the best-performing directed baseline (DHM) reached only 68.10%.

Ablation studies confirmed that removing the directionality component (treating the graph as undirected) caused performance to plummet, proving that the directional flow encoded in the complex Laplacian is essential for accurate reaction classification.

Conclusion

DLGNet introduces a powerful new way to model directed group interactions by treating hyperedges as first-class citizens. While the current work focuses on classification, the architecture's ability to learn "reaction fingerprints" suggests significant potential for future applications in retrosynthetic discovery and the analysis of complex metabolic or social networks. Future work will focus on optimizing the computational complexity of the DLG Laplacian construction for larger global reaction networks.

Summary updated

Abstract

Graphs and hypergraphs provide powerful abstractions for modeling interactions among a set of entities of interest and have been attracting a growing interest in the literature thanks to many successful applications in several fields. In particular, they are rapidly expanding in domains such as chemistry and biology, especially in the areas of drug discovery and molecule generation. One of the areas witnessing the fasted growth is the chemical reactions field, where chemical reactions can be naturally encoded as directed hyperedges of a hypergraph. In this paper, we address the chemical reaction classification problem by introducing the notation of a Directed Line Graph (DGL) associated with a given directed hypergraph. On top of it, we build the Directed Line Graph Network (DLGNet), the first spectral-based Graph Neural Network (GNN) expressly designed to operate on a hypergraph via its DLG transformation. The foundation of DLGNet is a novel Hermitian matrix, the Directed Line Graph Laplacian, which compactly encodes the directionality of the interactions taking place within the directed hyperedges of the hypergraph thanks to the DLG representation. The Directed Line Graph Laplacian enjoys many desirable properties, including admitting an eigenvalue decomposition and being positive semidefinite, which make it well-suited for its adoption within a spectral-based GNN. Through extensive experiments on chemical reaction datasets, we show that DGLNet significantly outperforms the existing approaches, achieving on a collection of real-world datasets an average relative-percentage-difference improvement of 33.01%, with a maximum improvement of 37.71%.
BibTeX
@misc{fiorini2024dlgnet,
  author = {Stefano Fiorini and Giulia M. Bovolenta and Stefano Coniglio and Michele Ciavotta and Pietro Morerio and Michele Parrinello and Alessio Del Bue},
  title = {{DLGNet: Hyperedge Classification through Directed Line Graphs for Chemical Reactions}},
  year = {2024},
  eprint = {2410.06969},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.06969},
}
Figure