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.
| Family | Representative models | Generation style | Typical strength |
|---|---|---|---|
| Random graph models | Erdős-Rényi, Barabási-Albert, stochastic block model | Rule-based sampling | Simple, analyzable baselines |
| Autoregressive models | GraphRNN, GRAN | Adds nodes and edges step by step | Flexible size, good structure |
| Variational autoencoders | GraphVAE, JT-VAE | Decodes a latent vector into a graph | Smooth latent space for optimization |
| Generative adversarial networks | MolGAN | Generator versus discriminator | Fast one-shot sampling |
| Normalizing flows | GraphNVP, GraphAF | Invertible mapping with exact likelihood | Exact density estimation |
| Diffusion models | GDSS, DiGress | Iterative denoising of nodes and edges | State-of-the-art sample quality |
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.
| Technique | How it works | Common use |
|---|---|---|
| Property conditioning | Feeds target values as model input | Molecules with given solubility |
| Latent space optimization | Searches a VAE latent space with a predictor | Improving binding scores |
| Reinforcement learning | Rewards valid, high-scoring graphs | Multi-objective drug design |
| Classifier guidance | Gradients of a predictor steer diffusion | Controlled structure sampling |
| Fragment-based assembly | Builds graphs from validated substructures | Guaranteed chemical validity |
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.
| Metric | What it measures | Domain |
|---|---|---|
| Degree MMD | Match of node degree distributions | Generic graphs |
| Clustering MMD | Match of local clustering coefficients | Generic graphs |
| Orbit MMD | Match of small subgraph counts | Generic graphs |
| Validity | Share of graphs obeying domain rules | Molecules, materials |
| Uniqueness and novelty | Share of distinct and unseen graphs | All domains |
| Fréchet ChemNet Distance | Similarity in learned chemical features | Molecules |
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.