Graph Guided Diffusion: Unified Guidance for Conditional Graph Generation

Victor M. Tenorio, Nicolas Zilberstein, Santiago Segarra, Antonio G. Marques · DOI

Introduction

Diffusion models have emerged as a powerful paradigm for generating realistic data, particularly in complex domains like molecular graphs and social networks. However, a significant challenge remains: guiding these models to satisfy specific, often non-differentiable or discrete, constraints. For instance, generating a molecule with a precise number of rings or a social network that adheres to fairness criteria is difficult because graphs are inherently combinatorial. Small changes in an adjacency matrix can lead to non-smooth, massive shifts in graph properties, rendering traditional gradient-based "classifier guidance" ineffective.

Problem Statement: Discreteness and Non-Differentiability

The difficulty in guiding graph diffusion models stems from two primary factors:

  1. Discreteness: Graphs are discrete structures. The mapping from a continuous latent space to a discrete graph structure is often sensitive and non-smooth.
  2. Non-Differentiability: Many critical graph rewards, such as triangle counts or isomorphism checks, do not possess gradients. Existing solutions often rely on differentiable approximations or rigid projection operators that lack flexibility for complex, real-world constraints.

Methodology: Steering via Stochastic Optimal Control

To address these challenges, we introduce Graph Guided Diffusion (GGDiff), a "plug-and-play" framework that reframes conditional generation as a stochastic optimal control (SOC) problem. In this view, the diffusion process is treated as a particle moving through space that must be "steered" toward a target region defined by a reward function.

Conceptual framework of GGDiff steering a diffusion process towards a constrained region (e.g., fair graphs) using zeroth-order guidance.

Stochastic Optimal Control and Feynman-Kac

GGDiff adds a "control" term (a drift) to the standard diffusion equation. By applying the Feynman-Kac formula, we derive an analytical expression for the optimal control that maximizes the final reward while minimizing deviation from the original model's path. Since the exact solution is often intractable, we employ a greedy approximation based on the current denoised estimate of the graph.

Zeroth-Order (ZO) Optimization

The "secret sauce" for handling non-differentiable rewards is Zeroth-Order optimization. Instead of requiring a gradient, GGDiff evaluates the reward for several sampled "candidate" directions (perturbations) to estimate a "pseudo-gradient." We propose three variants:

  • GGDiff-G: Utilizes standard gradients for differentiable rewards.
  • GGDiff-C (Best-of-N): Samples $N$ directions and selects the best one, proving highly effective for discrete graph tasks.
  • GGDiff-Z (Multi-point): Uses a weighted average of all sampled directions for a more robust estimate.

Experimental Evaluation

We evaluated GGDiff across five diverse datasets: Ego-small (citation networks), Community-small (synthetic community structures), Enzymes (protein structures), and QM9/ZINC250k (molecular benchmarks).

Key Results: Structural Constraints and Fairness

GGDiff demonstrates superior performance in satisfying complex structural constraints compared to existing state-of-the-art methods like PRODIGY.

Performance of GGDiff variants against baselines on structural constraint tasks across multiple datasets.

As shown in the results, GGDiff-C and GGDiff-G consistently achieve higher validity ($Val_{\mathcal{C}}$) and better distribution matching ($\Delta$ MMD) across tasks like limiting maximum degree or edge counts. In fairness-constrained tasks, GGDiff successfully reduced demographic parity debt ($\Delta$ DP) in social networks, ensuring equitable edge distribution without compromising the underlying community structure. Furthermore, in link prediction tasks on the ZINC250k dataset, GGDiff variants achieved over 98% accuracy in respecting observed entries.

Discussion and Future Work

GGDiff's "plug-and-play" nature allows it to be applied to pre-trained models without retraining, offering a versatile tool for zero-shot conditional generation. However, the framework introduces computational overhead due to multiple reward evaluations per diffusion step. Future work will explore extending GGDiff to discrete diffusion models and optimizing the variance of Zeroth-Order estimators to handle even larger, higher-dimensional graph structures.

Summary updated

BibTeX
@inproceedings{tenorio2025graph,
  author = {Victor M. Tenorio and Nicolas Zilberstein and Santiago Segarra and Antonio G. Marques},
  title = {{Graph Guided Diffusion: Unified Guidance for Conditional Graph Generation}},
  booktitle = {NPGML @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=Af3klve2Nb},
}
Figure