Graph generation

Also known as: graph generative model

On this page 8

Graph generation is the task of learning a probability distribution over graphs from examples and sampling new graphs that share their structural and attribute patterns. In graph learning, a model that performs this task is called a graph generative model, and it produces nodes, edges and their features rather than classifying or embedding an existing graph.

The field matters wherever the object of interest is naturally a graph: molecules in drug discovery, crystal and material structures, social and communication networks, and circuit layouts. Graph generation is harder than image or text generation because graphs have no fixed size, no natural node order and often strict validity constraints.

Why generating graphs is difficult

Three properties make graph generation a distinct problem. First, a graph with n nodes can be written in n! orderings, and all describe the same object, so a model must be permutation invariant or must handle orderings explicitly. Second, the adjacency matrix grows quadratically with node count, which limits scale.

Third, many domains impose hard constraints. A generated molecule must respect atom valence rules, a road network must be planar in most places and a citation graph must avoid edges pointing to the future. Models that ignore these rules often produce graphs that look plausible statistically but are chemically or physically invalid.

Main families of graph generative models

Graph generators fall into classical random graph models and deep generative models. Classical models use a few hand-set parameters to reproduce one property, while deep models learn complex distributions directly from data.

FamilyRepresentative modelsGeneration styleTypical strength
Random graph modelsErdős-Rényi, Barabási-Albert, stochastic block modelRule-based samplingSimple, analyzable baselines
Autoregressive modelsGraphRNN, GRANAdds nodes and edges step by stepFlexible size, good structure
Variational autoencodersGraphVAE, JT-VAEDecodes a latent vector into a graphSmooth latent space for optimization
Generative adversarial networksMolGANGenerator versus discriminatorFast one-shot sampling
Normalizing flowsGraphNVP, GraphAFInvertible mapping with exact likelihoodExact density estimation
Diffusion modelsGDSS, DiGressIterative denoising of nodes and edgesState-of-the-art sample quality
Families of graph generation methods

Autoregressive generators such as GraphRNN fix a node ordering, often breadth-first search, and predict each new node’s connections to earlier nodes. One-shot generators such as GraphVAE output the whole adjacency matrix at once, which is fast but requires costly graph matching to compare outputs with training graphs. Diffusion-based generators add noise to node and edge types and train a permutation-equivariant graph neural network, often a graph transformer, to reverse the corruption.

Conditional and goal-directed generation

Unconditional generation reproduces the training distribution, but most applications need conditional generation that targets desired properties. A model may receive a target property value, a scaffold to preserve or a partial graph to complete.

TechniqueHow it worksCommon use
Property conditioningFeeds target values as model inputMolecules with given solubility
Latent space optimizationSearches a VAE latent space with a predictorImproving binding scores
Reinforcement learningRewards valid, high-scoring graphsMulti-objective drug design
Classifier guidanceGradients of a predictor steer diffusionControlled structure sampling
Fragment-based assemblyBuilds graphs from validated substructuresGuaranteed chemical validity
Ways to steer a graph generator toward a goal

Fragment-based approaches such as the junction tree VAE generate a tree of chemical substructures first and then assemble atoms, which raises validity close to 100 percent for molecules at the cost of expressiveness.

How generated graphs are evaluated

Evaluating graph generation is notoriously difficult, because there is no single metric that captures realism. Researchers compare distributions of graph statistics between generated and reference sets, usually with maximum mean discrepancy, and add domain-specific checks.

MetricWhat it measuresDomain
Degree MMDMatch of node degree distributionsGeneric graphs
Clustering MMDMatch of local clustering coefficientsGeneric graphs
Orbit MMDMatch of small subgraph countsGeneric graphs
ValidityShare of graphs obeying domain rulesMolecules, materials
Uniqueness and noveltyShare of distinct and unseen graphsAll domains
Fréchet ChemNet DistanceSimilarity in learned chemical featuresMolecules
Common metrics for graph generation

A model can score well on validity while memorizing training graphs, so novelty must always be reported. MMD values also depend strongly on kernel choice and sample size, which makes comparisons across papers unreliable unless the protocol is identical.

Relation to other graph learning tasks

Graph generation reuses many building blocks of graph learning but answers a different question. Link prediction scores missing edges in one existing graph, whereas generation creates entire new graphs. A variational graph autoencoder can do both, yet in its original form it reconstructs edges of a fixed node set rather than sampling graphs of new sizes.

  • Message passing neural networks serve as encoders, discriminators and denoisers inside generators.
  • Graph structure learning infers edges for given nodes, a narrower problem than full generation.
  • Weisfeiler-Lehman expressiveness limits affect how well a generator can distinguish structures it creates.

Limitations and open problems

Current methods scale poorly beyond a few thousand nodes, because most predict pairwise edge probabilities. Sparse and hierarchical generators reduce cost, yet generating realistic large networks with millions of nodes still relies largely on classical models such as Kronecker graphs.

Other open issues include mode collapse in adversarial models, sensitivity to node ordering in autoregressive models and the gap between in-silico scores and laboratory success. A molecule that looks ideal to a property predictor may be impossible to synthesize, so practitioners add synthesizability filters and expert review.

The simple explanation

Many things in the world are made of points connected by links. A molecule is atoms joined by bonds. A social network is people joined by friendships. These structures are called graphs.

Graph generation teaches a computer to invent new graphs that look real. The computer studies many examples first. Then it builds fresh ones that follow the same rules. Think of a chef who tastes hundreds of dishes and then creates new recipes in the same style. The new recipes are original, yet they still make sense.

How it is used in practice

A pharmaceutical research group is searching for new inhibitors of a kinase enzyme. Its chemists have about 4,000 known active compounds, but testing millions of random molecules in the laboratory would be far too expensive.

The team trains a discrete diffusion model on a public library of drug-like molecules and then applies classifier guidance from a binding-affinity predictor and a synthesizability score. The model produces 50,000 candidate molecules, of which over 95 percent are chemically valid and almost all are novel. Filters for toxicity and synthesis cost reduce the list to 300 candidates.

Chemists synthesize and test 40 of these compounds. Several show measurable activity, and two become starting points for lead optimization. Graph generation did not replace laboratory work, but it narrowed the search space from millions of options to a short, promising list.