Graph Ordering: Towards the Optimal by Learning

Kangfei Zhao, Yu Rong, Jeffrey Xu Yu, Wenbing Huang, Junzhou Huang, Hao Zhang

TL;DR

This paper introduces DON-RL, a deep learning framework designed to solve the NP-hard problem of graph ordering—arranging a graph's vertices in a linear sequence to maximize structural locality. By combining a permutation-invariant neural network (Deep Order Network) with a reinforcement learning policy to navigate the massive search space, the authors consistently outperform state-of-the-art greedy heuristics, achieving up to 2.97× better graph compression and 37% more efficient edge partitioning.

What Problem Does This Paper Address?

Many critical graph tasks—like visualization, compression, and edge partitioning for distributed processing—depend on graph ordering. The goal is to find a permutation of vertices such that "similar" or "connected" nodes are placed close to each other in a linear sequence.

Mathematically, this involves maximizing a "locality score" within a sliding window. If you can group connected nodes together, your adjacency matrix becomes "dense" in specific areas, making it easier to compress and faster for CPUs to process due to better cache locality. However, finding the optimal order is a combinatorial nightmare (a general form of the Traveling Salesman Problem) and is NP-hard. Existing solutions rely on "greedy" heuristics that often get stuck in local optima and fail to capture the global structure of the graph.

Methods

The authors propose a two-part framework called DON-RL:

  1. Deep Order Network (DON): This is the core predictive model. Instead of using a fixed mathematical formula to decide which node comes next in an order, DON learns the "hidden locality" from data. It uses a DeepSets architecture, which is crucial because the model must be "permutation-invariant"—the quality of a partial ordering shouldn't change just because you shuffled the nodes already in that set.
  2. Reinforcement Learning (Policy Network): Training a model on every possible vertex combination is impossible (combinatorial explosion). The authors use a Policy Network to adaptively adjust which vertices the model "practices" on during training. It learns to focus on vertex segments that contribute most to the locality score, guiding the DON model to evolve more efficiently.

This "interactive" training allows the model to learn global patterns that greedy algorithms, which only look one step ahead, typically miss.

Datasets

The researchers evaluated their model on a mix of real-world and synthetic graphs:

  • Real-World: Wiki-vote (social), Facebook (social), p2p (file sharing), Arxiv-HEP (citation), Cora (citation), and PPI (biological).
  • Synthetic: Six graphs generated using Power-law and Erdös-Rényi models to test different densities and structural properties.
  • Preprocessing: They introduced a "Merged Vertex" strategy to reduce the search space by identifying equivalent nodes (automorphisms) before training.

Key Insights and Ideas

  • The "High-Degree" Fallacy: A common intuition is that high-degree nodes (hubs) are the most important for graph structure. The authors found (via Fig. 4) that this isn't always true for locality scores. In some graphs, adding high-degree nodes barely increases the locality score, while in others, the score increases regardless of degree. This justifies why a learned approach is better than a simple degree-based heuristic.
  • Global vs. Local: Greedy algorithms (like the baseline "GO") are powerful at finding local clusters but often "get stuck," creating dense local areas at the expense of global sparsity. DON-RL maintains a more compact global layout.
  • RL as a Filter: Instead of using RL to solve the ordering directly (which is too slow for large graphs), they use RL to curate the training data for the main network. This makes the training process self-adaptive and much more scalable.

Key Results

  • Locality Score: DON-RL outperformed the state-of-the-art greedy algorithm (GO) across all real-world datasets, with improvements in the locality score ranging from 1.8% to 8.2%. On synthetic power-law graphs, the improvement was as high as 35%.
  • Graph Compression: In a practical case study, DON-RL reduced the number of non-empty blocks in the adjacency matrix by 2.97× on Facebook data compared to the best existing ordering methods.
  • Edge Partitioning: When used to split a graph for distributed computing, the ordering produced by DON-RL reduced the "replication factor" (a measure of communication overhead) by up to 37% compared to standard greedy partitioning.

Limitations and Future Work

  • Training Overhead: While the inference (ordering a new graph) is efficient, the RL-based training process is computationally intensive compared to simple heuristics.
  • Generalization: The paper focuses on training and testing on the same graph (or distributions). A promising future direction is "zero-shot" graph ordering, where a model trained on one set of graphs can immediately order a completely unseen graph.
  • Scaling to Billions: While the authors tested on graphs with tens of thousands of nodes, real-world web-scale graphs have billions of edges. Extending this learned approach to that scale remains a significant engineering challenge.

Summary updated

BibTeX
@inproceedings{zhao2021graph,
  author = {Kangfei Zhao and Yu Rong and Jeffrey Xu Yu and Wenbing Huang and Junzhou Huang and Hao Zhang},
  title = {{Graph Ordering: Towards the Optimal by Learning}},
  booktitle = {WISE},
  year = {2021},
  doi = {10.1007/978-3-030-90888-1\_33},
}
Figure