Magnet (Mesh Aglomeration by Graph Neural Network) is an open-source Python library that provides a simple framework for mesh agglomeration in both two- and three-dimensions. Magnet allows to experiment with different neural network architectures, train them, and compare their performance to state-of-the-art methods like METIS and k-means on standard quality metrics. Magnet can also be easily integrated with other software, in particular, it already interfaces with lymph.
If you cannot wait, you can easily work with Magnet on Google colab, see our Google Colab notebook to get started!
Magnet is a Python package that can be installed with
pip install .However it comes with some sharp bits, especially in the interface with METIS and Matlab. For this reason we suggest to read the documentation, which is available at the github page
Examples on how to use Magnet are in the examples folder.
If you use Magnet please cite our pre-print
Antonietti, P.F., Caldana, M., Mazzieri, I. and Fraschini, A.R., 2025. MAGNET: an open-source library for mesh agglomeration by Graph Neural Networks. arXiv preprint arXiv:2504.21780.
The authors acknowledge the support of the ERC Synergy Grant n. 101115663 NEMESIS: NEw generation MEthods for numerical SImulationS
- Matteo Caldana matteo.caldana@polimi.it
- Andrea Re Fraschini andrea4.re@mail.polimi.it
