Small Synthetic Datasets
polygraph.datasets.PlanarGraphDataset
Bases: SplitGraphDataset
Planar graph dataset proposed by Martinkus et al. [1].
Each graph consists of 64 nodes and is connected and planar.

Dataset statistics:
| Metric | Train | Val | Test |
|---|---|---|---|
| # of Graphs | 128 | 32 | 40 |
| Min # of Nodes | 64 | 64 | 64 |
| Max # of Nodes | 64 | 64 | 64 |
| Avg # of Nodes | 64.00 | 64.00 | 64.00 |
| Min # of Edges | 173 | 174 | 174 |
| Max # of Edges | 181 | 181 | 181 |
| Avg # of Edges | 177.83 | 177.75 | 177.93 |
| Edge/Node Ratio | 2.78 | 2.78 | 2.78 |
| Is Undirected | True | True | True |
References
[1] Martinkus, K., Loukas, A., Perraudin, N., & Wattenhofer, R. (2022). SPECTRE: Spectral Conditioning Helps to Overcome the Expressivity Limits of One-shot Graph Generators. In Proceedings of the 39th International Conference on Machine Learning (ICML).
is_valid(graph)
Check whether graph is connnected and planar.
| Parameters: |
|
|---|
| Returns: |
|
|---|
polygraph.datasets.SBMGraphDataset
Bases: SplitGraphDataset
SBM graph dataset proposed by Martinkus et al. [1].
The graphs are sampled from stochastic block models with random parameters.
- The number of communities is sampled uniformly at random from 2-5 (inclusive).
- The number of nodes per community is sampled uniformly at random from 20-40 (inclusive).
- The intra-community edge probability is set at 0.3.
- The inter-community edge probability is set at 0.005.

Dataset statistics:
| Metric | Train | Val | Test |
|---|---|---|---|
| # of Graphs | 128 | 32 | 40 |
| Min # of Nodes | 44 | 49 | 54 |
| Max # of Nodes | 187 | 162 | 174 |
| Avg # of Nodes | 105.99 | 91.28 | 107.85 |
| Min # of Edges | 129 | 183 | 210 |
| Max # of Edges | 1129 | 857 | 972 |
| Avg # of Edges | 512.51 | 425.19 | 521.88 |
| Edge/Node Ratio | 4.84 | 4.66 | 4.84 |
| Is Undirected | True | True | True |
References
[1] Martinkus, K., Loukas, A., Perraudin, N., & Wattenhofer, R. (2022). SPECTRE: Spectral Conditioning Helps to Overcome the Expressivity Limits of One-shot Graph Generators. In Proceedings of the 39th International Conference on Machine Learning (ICML).
is_valid(graph)
Check if a graph is a valid SBM graph.
polygraph.datasets.LobsterGraphDataset
Bases: SplitGraphDataset
Dataset of lobster graphs proposed by Liao et al. [1].
A lobster graph is a tree which has a backbone path such that each node in the tree is at most two hops away from this backbone.

Dataset statistics:
| Metric | Train | Val | Test |
|---|---|---|---|
| # of Graphs | 60 | 20 | 20 |
| Min # of Nodes | 10 | 11 | 14 |
| Max # of Nodes | 98 | 98 | 84 |
| Avg # of Nodes | 53.67 | 56.30 | 50.80 |
| Min # of Edges | 9 | 10 | 13 |
| Max # of Edges | 97 | 97 | 83 |
| Avg # of Edges | 52.67 | 55.30 | 49.80 |
| Edge/Node Ratio | 0.98 | 0.98 | 0.98 |
| Is Undirected | True | True | True |
Warning
In the original dataset [1], the validation set was a subset of the training set. Here, we use disjoint splits.
References
[1] Liao, R., Li, Y., Song, Y., Wang, S., Hamilton, W., Duvenaud, D., Urtasun, R., & Zemel, R. (2019). Efficient Graph Generation with Graph Recurrent Attention Networks. In Advances in Neural Information Processing Systems (NeurIPS).
is_valid(graph)
Check if a graph is a valid lobster graph.