Official implementation of the paper "MaxCutPool: differentiable feature-aware Maxcut for pooling in graph neural networks" by Carlo Abate and Filippo Maria Bianchi.
This repository contains the implementation of MaxCutPool, a novel approach to compute the MAXCUT in attributed graphs. The method is designed to work with graphs that have features associated with both nodes and edges.
Key features:
- Fully differentiable architecture
- Robust to underlying graph topology
- Optimizes MAXCUT jointly with other objectives
- Implements a hierarchical graph pooling layer for GNNs
- Particularly effective for heterophilic graphs
To install the required packages, create a conda environment using the provided environment file:
conda env create -f environment.yml
conda activate maxcutpoolThe main dependencies include:
- Python 3.10
- PyTorch >= 2.0.0
- PyTorch Geometric (PyG)
- PyTorch Lightning
- Hydra
- Tensorboard (for logging)
- Various scientific computing libraries (numpy, scipy, etc.)
For a complete list of dependencies, see environment.yml.
For a basic example of how to use the MaxCutPool layer, check out example.py. This file demonstrates:
- Basic setup of the layer
- Integration with PyTorch Geometric
- Training and evaluation on a sample dataset
To replicate the experiments from the paper, you can use the following run scripts:
- MAXCUT evaluation experiments:
python run_maxcut.py # the GNN with MaxCutPool
python run_maxcut_baseline.py # used for comparison- Graph classification experiments:
python run_graph_classification.py- Node classification experiments:
python run_node_classification.pyNote
Each script uses Hydra for configuration management. The corresponding YAML config files can be found in the config directory.
Tip
You can override any configuration parameter from the command line, for example:
python run_graph_classification.py dataset=expwl1 pooler=edgepoolThis repository is structured as follows:
./
βββ config/ # Run configuration files
βββ source/ # Main package directory
β βββ data/ # Dataset handling
β βββ layers/ # Neural network layers
β β βββ maxcutpool/ # MaxCutPool layer implemenetation
β β βββ edgepool/ # EdgePool layer implementation
β β βββ kmis/ # KMIS layer implementation
β β βββ ndp.py # NDP layer implementation
β βββ models/ # Architectures for the different downstream tasks
β βββ pl_modules/ # PyTorch Lightning modules for each downnstream task
β βββ utils/ # Utility functions
βββ example.py # Quick start example
βββ run_maxcut.py # MAXCUT experiment runner
βββ run_maxcut_baseline.py # MAXCUT baselines used for comparison
βββ run_classification.py # Classification experiment runner
βββ run_node_classification.py # Node classification runner
βββ environment.yml # Conda environment specification
βββ README.md # This README file
βββ requirements.txt # PyG dependencies
βββ LICENSE # MIT License
If you find this code useful please consider citing our paper:
@inproceedings{abate2025maxcutpool,
title={MaxCutPool: differentiable feature-aware Maxcut for pooling in graph neural networks},
author={Abate, Carlo and Bianchi, Filippo Maria},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=xlbXRJ2XCP}
}
