CCGG: A Deep Autoregressive Model for Class-Conditional Graph Generation

Yassaman Ommi, Matin Yousefabadi, Faezeh Faez, Amirmojtaba Sabour, Mahdieh Soleymani Baghshah, Hamid R. Rabiee

TL;DR

CCGG (Class-Conditioned Graph Generator) is a novel autoregressive model designed to generate graphs that belong to specific categories, such as distinguishing between different types of proteins or chemical compounds. By combining a block-by-block generation strategy with a "discounted" classification loss and differentiable sampling, CCGG produces more realistic and class-accurate graphs than previous state-of-the-art methods.

What Problem Does This Paper Address?

While deep learning has made massive strides in generating images and text, graph generation is significantly more complex due to the discrete nature of edges and the lack of a fixed "start" or "end" point. Most existing graph generators are unconditional—they learn to create graphs that look like a general training set but cannot be "steered" to create a specific type of graph (e.g., "generate a molecule that is specifically anti-cancer").

The authors identify a gap in class-conditional graph generation. Previous attempts often struggled to maintain the structural integrity of the graph while satisfying the class constraint, or they relied on GAN-based architectures that are notoriously difficult to train for discrete structures like graphs.

Methods

CCGG builds upon the GRAN (Graph Recurrent Attention Network) architecture, which generates graphs autoregressively by adding blocks of nodes and their associated edges in a step-by-step manner. The authors introduce four key components to make this process class-aware:

  1. Condition Injector: At each generation step, the target class label is transformed into a vector and concatenated with the existing node representations. This ensures the model "knows" which class it is trying to build from the very first node.
  2. Dual Classifiers: The model uses two additional components during training:
  3. A Graph Classifier (GraphSAGE) that evaluates the entire generated structure.
  4. A Node Classifier (MLP) that leverages node-level labels (common in chemical and biological datasets) to refine local topology.
  5. Discounted Loss Function: The authors realized that a classifier cannot accurately judge a half-finished graph. They introduced a "discount factor" ($\gamma$) that weights the classification loss more heavily as the graph approaches its final size, focusing the model's effort on the final structural correctness.
  6. Gumbel-Softmax Trick: To allow gradients to flow from the classifier back to the generator through the discrete "choice" of creating an edge, the authors used the Gumbel-Softmax reparameterization. This makes the non-differentiable sampling process differentiable.

Datasets

The model was evaluated on two standard benchmarks in the graph community:

  • PROTEINS: A dataset of 1,113 graphs representing protein structures, categorized as either enzymes or non-enzymes. Graphs range from 100 to 620 nodes.
  • NCI1: A cheminformatics dataset containing 4,110 graphs of chemical compounds, classified based on their activity against lung cancer cells. These are smaller graphs, ranging from 8 to 111 nodes.

Key Insights and Ideas

  • The "Incomplete Graph" Challenge: One of the most insightful parts of the paper is the handling of the classification loss. By acknowledging that a classifier's feedback is "noisier" when a graph is only 10% complete, the discounted loss prevents the model from being penalized prematurely for structures that haven't fully formed yet.
  • Topology vs. Labeling: Unlike previous models that might get the "label" right but the "shape" wrong, CCGG uses Graph Neural Networks (GNNs) as the core generator. This allows it to capture complex topological features (like triangles and long-range connections) better than simple MLP-based generators.
  • Feedback Loops Matter: The inclusion of a pre-trained classifier as a "teacher" during the generation process significantly boosts the model's ability to produce class-distinctive features compared to just injecting a label as an input.

Key Results

CCGG was compared against CONDGEN, a leading GAN-based conditional graph generator.

  • Statistical Accuracy: CCGG significantly outperformed the baseline across metrics like the Largest Connected Component (LCC), Triangle Count (TC), and the Gini index of degree distribution. For example, on the NCI1 dataset, CCGG's LCC difference from the "real" data was roughly 1.2, compared to 9.9 for the baseline.
  • Classification Quality: When the generated graphs were fed into independent classifiers (GraphSAGE, DiffPool, and DGCNN), CCGG's outputs were correctly identified as the target class much more frequently than the baseline's outputs, achieving higher AUC scores across the board.
  • Visual Fidelity: Qualitatively, the model maintained the "look and feel" of the original classes, successfully learning the distinct structural motifs that define enzymes versus non-enzymes.

Limitations and Future Work

The authors note a few areas for improvement:

  • Classifier Dependency: The generator's performance is somewhat tied to the quality of the classifier used during training. If the classifier has inherent biases or errors (as noted with the DGCNN evaluator), the generator may inherit them.
  • Scalability: While GRAN-based models are more scalable than many others, generating extremely large graphs (thousands of nodes) remains a computational challenge for autoregressive approaches.
  • Future Directions: The authors suggest extending this work to generate even larger graphs and exploring more complex conditions beyond simple class labels, such as generating graphs based on natural language descriptions.

Summary updated

BibTeX
@inproceedings{ommi2022ccgg,
  author = {Yassaman Ommi and Matin Yousefabadi and Faezeh Faez and Amirmojtaba Sabour and Mahdieh Soleymani Baghshah and Hamid R. Rabiee},
  title = {{CCGG: A Deep Autoregressive Model for Class-Conditional Graph Generation}},
  booktitle = {The Web Conference},
  year = {2022},
  doi = {10.1145/3487553.3524721},
}
Figure