Graph Partitioning and Sparse Matrix Ordering using Reinforcement Learning

Alice Gatti, Zhixiong Hu, Pieter Ghysels, Esmond G. Ng, Tess E. Smidt

This paper presents a novel approach to graph partitioning and sparse matrix ordering by integrating Deep Reinforcement Learning (DRL) with Graph Neural Networks (GNNs). By framing partitioning as a learning problem within a traditional multilevel framework, the authors demonstrate that AI-driven agents can match the performance of long-standing combinatorial heuristics like METIS and SCOTCH.

TL;DR

The authors develop a multilevel graph partitioning method using DRL agents equipped with SAGE and GAT convolution layers to find high-quality edge and vertex separators. The approach generalizes remarkably well, allowing models trained on small, synthetic graphs to effectively partition large, complex real-world meshes and reduce fill-in during sparse matrix factorization.

What Problem Does This Paper Address?

Graph partitioning—dividing a graph into balanced subgraphs while minimizing the number of cut edges—is a cornerstone of parallel computing. It is used to distribute workloads across processors and minimize inter-node communication. However, the problem is NP-complete.

Existing state-of-the-art (SOTA) tools like METIS rely on sequential heuristics. While effective, these algorithms often struggle to exploit the massive parallelism of modern hardware like GPUs and TPUs. Furthermore, in the context of sparse direct solvers, finding optimal "vertex separators" is critical for nested dissection, a technique used to reorder matrix rows and columns to minimize "fill-in" (extra non-zero entries created during factorization). The authors seek to determine if deep learning can provide a more flexible, hardware-efficient alternative to these classical heuristics.

Methods

The authors adopt a multilevel approach, which is standard in the field but replace key heuristic components with DRL agents:

  1. Coarsening: The graph is recursively simplified into smaller representations using the graclus clustering algorithm.
  2. Coarsest Partitioning: Once the graph is small enough, a DRL agent (using Graph Attention Networks (GAT)) partitions it.
  3. Refinement: The partition is projected back to the finer graph. A second DRL agent (using SAGEConv layers) refines the boundary. To maintain efficiency, this agent only operates on a $k$-hop subgraph around the current cut rather than the entire graph.

The agents are trained using the Synchronous Advantage Actor-Critic (A2C) algorithm. The "Actor" decides which nodes to move between partitions, while the "Critic" estimates the value of the current state to stabilize training.

The multilevel approach: coarsening, partitioning the base, and refining during interpolation.

Datasets

The models were evaluated on several classes of graphs:

  • Delaunay Triangulations: Planar graphs generated from random points, used primarily for training and baseline testing.
  • Finite Element Meshes: Complex geometries (GradedL, Hole3, Hole6) representing real-world engineering problems.
  • SuiteSparse Matrix Collection: A diverse benchmark set of 2D and 3D discretizations from various scientific applications.

Notably, the models were often trained on small graphs (under 5,000 nodes) and tested on graphs up to 90,000 nodes to evaluate their ability to generalize.

Key Insights and Ideas

  • Generalization is the "Killer App": One of the most significant findings is that a DRL agent trained on simple Delaunay triangulations can successfully partition much larger and structurally different meshes (like those with holes or different sparsity patterns).
  • Normalized Cut vs. Min-Cut: The paper emphasizes minimizing the normalized cut, which balances the "volume" (sum of degrees) of partitions. A simple minimum cut often results in highly unbalanced partitions (e.g., one node vs. the rest of the graph), which is useless for load balancing.
  • Vertex Separators for Solvers: Beyond just cutting edges, the authors adapt their method to find vertex separators (nodes that, when removed, split the graph). This allows the DRL method to be used directly for nested dissection in sparse solvers like SuperLU.
Comparison between a minimum cut (unbalanced) and a minimum normalized cut (balanced).

Key Results

  • Competitive Quality: The DRL-based method achieved partitioning quality (measured by normalized cut and balance) that was nearly identical to METIS and SCOTCH across most test cases.
  • Solver Performance: When used for nested dissection reordering, the DRL method significantly outperformed the standard Approximate Minimum Degree (AMD) ordering and was highly competitive with METIS-based reordering in terms of reducing matrix fill-in.
  • Scalability: The authors demonstrate that the refinement step has a computational complexity of $O(n)$ for 2D graphs and $O(n^{4/3})$ for 3D graphs, suggesting it can scale to very large systems.

Limitations and Future Work

  • Implementation Overhead: The current implementation is in Python, which is significantly slower than the highly optimized C/C++ code of METIS. The authors plan to port the method to C++ to achieve competitive runtimes.
  • Sequential Action Selection: The agent currently moves one node at a time. Future work could involve "multi-action" selection to speed up the refinement process.
  • Hyperparameter Sensitivity: While the model generalizes well, the authors note that further tuning of the GNN architecture and reward functions could potentially lead to results that surpass current SOTA heuristics.

Summary updated

BibTeX
@misc{gatti2021graph,
  author = {Alice Gatti and Zhixiong Hu and Pieter Ghysels and Esmond G. Ng and Tess E. Smidt},
  title = {{Graph Partitioning and Sparse Matrix Ordering using Reinforcement Learning}},
  year = {2021},
  eprint = {2104.03546},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.03546},
}
Figure