NetGAN: Generating Graphs via Random Walks

Aleksandar Bojchevski, Oleksandr Shchur, Daniel Zügner, Stephan Günnemann

Abstract

We propose NetGAN - the first implicit generative model for graphs able to mimic real-world networks. We pose the problem of graph generation as learning the distribution of biased random walks over the input graph. The proposed model is based on a stochastic neural network that generates discrete output samples and is trained using the Wasserstein GAN objective. NetGAN is able to produce graphs that exhibit well-known network patterns without explicitly specifying them in the model definition. At the same time, our model exhibits strong generalization properties, as highlighted by its competitive link prediction performance, despite not being trained specifically for this task. Being the first approach to combine both of these desirable properties, NetGAN opens exciting avenues for further research.

Introduction

Generating realistic graphs is a significant challenge in network science. Traditional "explicit" models, such as the Barabási-Albert model, rely on predefined mathematical rules that often fail to capture the complex, multi-faceted nature of real-world networks, including community structures and specific degree distributions.

Modern deep learning approaches face three primary hurdles:

  1. Discreteness: Graphs consist of discrete nodes and edges, complicating the use of gradient-based optimization.
  2. Permutation Invariance: A graph's identity is independent of node numbering, yet most neural networks are sensitive to input ordering.
  3. Data Scarcity: Often, researchers have access to only a single, massive graph (e.g., a specific social network) rather than a large dataset of similar graphs.

NetGAN addresses these issues by shifting the focus from generating adjacency matrices to modeling the distribution of biased random walks.

Methodology

The core innovation of NetGAN is treating graph generation as learning a distribution over random walks. This approach bypasses the $O(N^2)$ computational explosion associated with adjacency matrices by focusing on sequences of nodes.

The Architecture

NetGAN utilizes a Generative Adversarial Network (GAN) framework where both the Generator ($G$) and Discriminator ($D$) are based on Long Short-Term Memory (LSTM) networks.

The NetGAN generator architecture uses LSTMs to produce sequences of nodes, employing a Gumbel-softmax estimator to handle discrete sampling.

The Workflow

  1. Sampling: Biased, second-order random walks are extracted from the original graph to serve as training data.
  2. Generation: The Generator transforms a latent noise vector into synthetic node sequences. To maintain differentiability despite the discrete nature of node selection, the model employs the Straight-Through Gumbel-softmax estimator.
  3. Discrimination: The Discriminator learns to distinguish between real walks from the original graph and synthetic walks from the Generator.
  4. Reconstruction: After training, the Generator produces thousands of walks. NetGAN counts node transitions to form a score matrix, which is then sparsified and binarized to create a new synthetic adjacency matrix.

Results and Key Insights

NetGAN demonstrates a remarkable ability to capture the "logic" of a network rather than simply memorizing its structure. By using early stopping criteria based on validation link prediction, the model avoids overfitting and exhibits strong generalization.

Structural Fidelity and Visual Similarity

NetGAN consistently outperforms traditional baselines (like DC-SBM and BTER) in matching various graph statistics, including triangle counts, clustering coefficients, and degree distributions. Qualitatively, the synthetic graphs maintain the visual "look and feel" of the original community clusters.

Comparison between the original Citeseer graph and the NetGAN-generated version, showing high visual similarity and a closely matched degree distribution.

Despite not being specifically trained for the task, NetGAN achieves state-of-the-art results in link prediction. On the CITESEER dataset, it reached a 96.30% AUC, outperforming dedicated embedding methods such as node2vec. This suggests that the model effectively learns the underlying structural grammar of the network.

Conclusion and Future Work

NetGAN represents a significant step forward in graph generation, combining structural fidelity with generalization. However, several avenues for future research remain:

  • Scalability: While more efficient than matrix-based models, the reconstruction phase still requires a high volume of sampled walks for stability.
  • Node Attributes: The current model focuses on topology; incorporating node features (text, categories) is a vital next step.
  • Dynamic Modeling: Adapting NetGAN to model temporal changes in networks remains an open challenge.

Summary updated

BibTeX
@inproceedings{bojchevski2018netgan,
  author = {Aleksandar Bojchevski and Oleksandr Shchur and Daniel Zügner and Stephan Günnemann},
  title = {{NetGAN: Generating Graphs via Random Walks}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=rkbXti-uZB},
}
Figure