PyTorch-native message passing beyond pairwise edges
A PyTorch library that treats graphs and hypergraphs as native structures, baking Laplacians and cross-order message passing directly into the objects themselves.

What it does
DHG is a PyTorch framework for Graph and Hypergraph Neural Networks. It wraps graphs, directed graphs, bipartite graphs, and hypergraphs into objects that carry their own spectral and spatial operations—so you can smooth features with a Laplacian or pass messages from vertices to hyperedges without leaving the PyTorch ecosystem.
The interesting bit
Instead of treating structure as passive adjacency data, DHG attaches operations like smoothing_with_GCN and v2e directly to the graph or hypergraph object. It also bundles an Auto-ML module built on Optuna that can tune both model hyperparameters and the structure construction itself.
Key highlights
- Supports both low-order (graph, digraph, bipartite) and high-order (hypergraph) structures in one framework.
- Spectral and spatial operations are attached to structure objects, so a hypergraph knows how to smooth its own features.
- Includes an Auto-ML module (
dhg.experiments) powered by Optuna for joint tuning of structure and model hyperparameters. - Provides visualization tools for rendering graphs, hypergraphs, directed graphs, and bipartite graphs.
- Ships with random generators, public datasets, evaluation metrics, and implementations of recent models.
Caveats
- PyTorch support is pinned to versions
>= 1.12.1, < 2.0, which may conflict with newer projects. - The nightly development version is explicitly flagged as potentially unstable and not fully tested.
- The README showcases API usage but does not provide quantitative benchmarks or performance comparisons against other libraries.
Verdict
Researchers working on hypergraph neural networks or multi-domain message passing who want to stay inside PyTorch should look here. If you need battle-tested production graph infrastructure or the latest PyTorch 2.x features, this is probably not your toolkit yet.
Frequently asked
- What is iMoonLab/DeepHypergraph?
- A PyTorch library that treats graphs and hypergraphs as native structures, baking Laplacians and cross-order message passing directly into the objects themselves.
- Is DeepHypergraph open source?
- Yes — iMoonLab/DeepHypergraph is open source, released under the Apache-2.0 license.
- What language is DeepHypergraph written in?
- iMoonLab/DeepHypergraph is primarily written in Python.
- How popular is DeepHypergraph?
- iMoonLab/DeepHypergraph has 871 stars on GitHub.
- Where can I find DeepHypergraph?
- iMoonLab/DeepHypergraph is on GitHub at https://github.com/iMoonLab/DeepHypergraph.