SNACK: A Sequential Notation Framework for Probabilistic Graph Generation
Organizations: Equal contribution · Seoul National University
Abstract
We introduce SNACK, a string representation for probabilistic graph generation that enables sequence models to generate and model graphs with discrete node and edge features. SNACK linearizes graphs by encoding the nonzero entries of the lower-triangular adjacency matrix, establishing a bijective correspondence between valid sequences and ordered adjacency matrices. This design enables invalid logit masking to enforce structural constraints--such as chemical valence and ordering rules--guaranteeing 100% valid generated sequences. SNACK also enables principled string-based GFlowNet training by explicitly accounting for node-ordering symmetries. Across standard graph-generation tasks and molecular distribution-learning benchmarks, SNACK achieves competitive sample quality, while substantially improving the throughput of GFlowNet training relative to graph-based generation. Probing analyses further show that models trained on SNACK encode meaningful local and global graph structure despite receiving only sequential supervision. These results position SNACK as a practical framework for probabilistic graph generation with deep sequence models.
Figures & tables
| Planar | Enzymes | SBM | Grid | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. |
| Training | 0.001 | 0.004 | 0.000 | 0.010 | 0.019 | 0.009 | 0.015 | 0.001 | 0.037 | 0.000 | 0.000 | 0.000 |
| GraphRNN | 0.005 | 0.278 | 1.254 | 0.017 | 0.062 | 0.046 | 0.006 | 0.058 | 0.079 | 0.011 | 0.000 | 0.021 |
| GDSS | 0.250 | 0.393 | 0.587 | 0.026 | 0.061 | 0.009 | 0.496 | 0.456 | 0.717 | 0.111 | 0.005 | 0.070 |
| DiGress | 0.000 | 0.002 | 0.008 | 0.011 | 0.039 | 0.010 | 0.006 | 0.051 | 0.058 | 0.016 | 0.000 | 0.004 |
| GEEL | 0.001 | 0.010 | 0.001 | 0.005 | 0.018 | 0.006 | 0.025 | 0.003 | 0.026 | 0.000 | 0.000 | 0.000 |
| QM9 | MOSES | |||||||||
| Method | Valid | FCD | SNN | Frag | Scaf | Valid | FCD | SNN | Frag | Scaf |
| SMILES | 0.995 | 0.053 | 0.630 | 0.995 | 0.976 | 0.993 | 0.100 | 0.528 | 1.000 | 0.898 |
| SELFIES | 1.000 | 0.037 | 0.625 | 0.995 | 0.975 | 1.000 | 0.119 | 0.514 | 1.000 | 0.896 |
| SAFE | 0.969 | 0.113 | 0.611 | 0.992 | 0.956 | 0.989 | 0.258 | 0.496 | 0.999 | 0.877 |
| STGG | 1.000 | 0.121 | 0.602 | 0.994 | 0.962 | 1.000 | 0.114 | 0.528 | 1.000 | 0.891 |
| GEEL | 0.995 | 0.058 | 0.618 | 0.993 | 0.974 | 0.997 | 0.104 | 0.531 | 1.000 | 0.894 |
| Method | Success |
|---|---|
| SMILES | 0.152 |
| SELFIES | 0.181 |
| SAFE | 0.057 |
| STGG | 0.003 |
| GEEL | 0.000 |
| G2PT | 0.000 |
| Reward | Method | Avg. Reward | Diversity | Top 100 reward | Top 100 div. | Div. Top 100 | Uniq. Frac. |
|---|---|---|---|---|---|---|---|
| Gap | Graph | ||||||
| SNACK (V) | |||||||
| SNACK (V+B) | |||||||
| Ari | Graph | ||||||
| SNACK (V) | |||||||
| SNACK (V+B) |
| Method | Improvement | Similarity | Success |
|---|---|---|---|
| JT-VAE | 97.5% | ||
| GCPN | 100% | ||
| GraphDF | 100% | ||
| SNACK | 100% |
| QM9 | MOSES | |
|---|---|---|
| Unif. | ||
| CM | ||
| BFS |
| Adjacency | SPD | |||
|---|---|---|---|---|
| Model | Accuracy | AUROC | MSE | MAE |
| Random | 0.9191 | 0.9362 | 3.0564 | 1.2897 |
| SMILES | 0.9894 | 0.9970 | 1.2722 | 0.8148 |
| SNACK | 0.9976 | 0.9998 | 1.6659 | 0.9250 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Ego-small | Community-small | Planar | Lobster | |||||||||
| Method | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. |
| Training | 0.021 | 0.031 | 0.012 | 0.016 | 0.032 | 0.003 | 0.001 | 0.004 | 0.000 | 0.007 | 0.000 | 0.005 |
| GraphVAE | 0.130 | 0.170 | 0.050 | 0.350 | 0.980 | 0.540 | – | – | – | – | – | – |
| GraphRNN | 0.090 | 0.220 | 0.003 | 0.080 | 0.120 | 0.040 | 0.005 | 0.278 | 1.254 | 0.000 | 0.000 | 0.000 |
| GRAN | 0.009 | 0.038 | 0.009 | 0.005 | 0.142 | 0.090 | 0.001 | 0.043 | 0.001 | 0.038 | 0.000 | 0.001 |
| Enzymes | SBM | Ego | Grid | |||||||||
| Method | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. | Deg. | Clus. | Orb. |
| Training | 0.010 | 0.019 | 0.009 | 0.015 | 0.001 | 0.037 | 0.010 | 0.003 | 0.017 | 0.000 | 0.000 | 0.000 |
| GraphVAE | 1.369 | 0.629 | 0.191 | – | – | – | – | – | – | 1.619 | 0.000 | 0.919 |
| GraphRNN | 0.017 | 0.062 | 0.046 | 0.006 | 0.058 | 0.079 | 0.117 | 0.615 | 0.043 | 0.011 | 0.000 | 0.021 |
| GRAN | 0.023 | 0.031 | 0.169 | 0.011 | 0.055 | 0.054 | 0.026 | 0.342 | 0.254 | 0.001 | 0.004 | 0.002 |
| Method | Valid | FCD | SNN | Frag | Scaf |
|---|---|---|---|---|---|
| SMILES | |||||
| SELFIES | |||||
| GEEL | |||||
| SNACK (None) | |||||
| SNACK (V+B) |
| Method | Valid | Unique1 | Unique2 | IntDiv | IntDiv2 | Filters | Novel |
|---|---|---|---|---|---|---|---|
| Training Dataset | 1.0000 | 1.0000 | 1.0000 | 0.8567 | 0.8508 | 1.0000 | 0.0000 |
| HMM [ 37 ] | 0.0760 | 0.6230 | 0.5671 | 0.8466 | 0.8104 | 0.9024 | 0.9994 |
| NGRAM [ 37 ] | 0.2376 | 0.9740 | 0.9217 | 0.8738 | 0.8644 | 0.9582 | 0.9694 |
| Combinatorial [ 67 ] | 1.0000 | 0.9983 | 0.9909 | 0.8732 | 0.8666 | 0.9557 | 0.9878 |
| CharRNN [ 68 ] | 0.9748 | 1.0000 | 0.9994 | 0.8562 | 0.8503 | 0.9943 | 0.8419 |
| AAE [ 37 ] | 0.9368 | 1.0000 | 0.9994 | 0.8557 | 0.8499 | 0.9960 | 0.7931 |
| FCD ( ) | SNN ( ) | Frag ( ) | Scaf ( ) | |||||
| Method | Test | TestSF | Test | TestSF | Test | TestSF | Test | TestSF |
| Training Dataset | 0.0080 | 0.4755 | 0.6419 | 0.5859 | 1.0000 | 0.9986 | 0.9907 | 0.0000 |
| HMM [ 37 ] | 24.466 | 25.431 | 0.3876 | 0.3795 | 0.5754 | 0.5681 | 0.2065 | 0.0490 |
| NGRAM [ 37 ] | 5.5069 | 6.2306 | 0.5209 | 0.4997 | 0.9846 | 0.9815 | 0.5302 | 0.0977 |
| Combinatorial [ 67 ] | 4.2375 | 4.5113 | 0.4514 | 0.4388 | 0.9912 | 0.9904 | 0.4445 | 0.0865 |
| CharRNN [ 68 ] | 0.0732 | 0.5204 | 0.6015 | 0.5649 | 0.9998 | 0.9983 | 0.9242 | 0.1101 |
| Target | Metric | SNACK | SMILES | Random |
|---|---|---|---|---|
| Adjacency | Accuracy | 0.9976 | 0.9894 | 0.9191 |
| AUROC | 0.9998 | 0.9970 | 0.9362 | |
| SPD | MSE | 1.6659 | 1.2722 | 3.0564 |
| MAE | 0.9250 | 0.8148 | 1.2897 |
Graph Generation
Graph generation builds models and algorithms that create graphs with desired structures, properties, or distributions.
See all 67 papers