NAGphormer: A Tokenized Graph Transformer for Node Classification in Large Graphs

Jinsong Chen, Kaiyuan Gao, Gaichao Li, Kun He
6/10/2022
cs.LGcs.AI
transformer-attentiongnn

Official code: JHL-HUST/NAGphormer (137 stars, Python, Apache-2.0, last commit 2024-03-05).

Abstract

The graph Transformer emerges as a new architecture and has shown superior performance on various graph mining tasks. In this work, we observe that existing graph Transformers treat nodes as independent tokens and construct a single long sequence composed of all node tokens so as to train the Transformer model, causing it hard to scale to large graphs due to the quadratic complexity on the number of nodes for the self-attention computation.

Show full abstract

To this end, we propose a Neighborhood Aggregation Graph Transformer (NAGphormer) that treats each node as a sequence containing a series of tokens constructed by our proposed Hop2Token module. For each node, Hop2Token aggregates the neighborhood features from different hops into different representations and thereby produces a sequence of token vectors as one input. In this way, NAGphormer could be trained in a mini-batch manner and thus could scale to large graphs. Moreover, we mathematically show that as compared to a category of advanced Graph Neural Networks (GNNs), the decoupled Graph Convolutional Network, NAGphormer could learn more informative node representations from the multi-hop neighborhoods. Extensive experiments on benchmark datasets from small to large are conducted to demonstrate that NAGphormer consistently outperforms existing graph Transformers and mainstream GNNs. Code is available at https://github.com/JHL-HUST/NAGphormer.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

NAGphormer: A Tokenized Graph Transformer for Node Classification in Large Graphs

13715PythonJan 23, 20232 years agoApache-2.0

Similar Papers

Cite this paper

@article{chen2022nagphormer,
  title  = {NAGphormer: A Tokenized Graph Transformer for Node Classification in Large Graphs},
  author = {Jinsong Chen and Kaiyuan Gao and Gaichao Li and Kun He},
  year   = {2022},
  eprint = {2206.04910},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2206.04910}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2206.04910.svg)](https://codeofpaper.com/paper/2206.04910)

Discussion