Can network measures enhance the predictive capability of Graph Neural Networks (GNNs) for the stability of power grids, and can they aid in the generalization of models to real-world networks?
The answer is affirmative. In our paper, we present, for the first time, a benchmark that analyzes 48 network measures within the context of GNN-based stability assessments, introducing two strategies for their integration into the GNN framework: NSGNN-F and NSGNN-S.
Our findings reveal that prioritizing measures with consistent distributions across different grids as inputs or treating measures as auxiliary supervised information significantly improves the model’s generalization ability to realistic grid topologies.
In this NSGNN package we provide several Network Measure encodings and GNN model choices, implementing for both NSGNN-F and NSGNN-S. One can easily try our model with different GNN layer or different combination of network measures. NSGNN is built based on PyG, GraphGym from PyG2, and GraphGPS. We thank them for providing the codes and tools. Specifically PyG v2.2 is required.
Summary of 48 network measures evaluated, categorized into Nodal and Global types and indexed serially. Each entry includes measure names or definitions with relevant citations.
Name / Definition | Name / Definition | Name / Definition | Name / Definition |
---|---|---|---|
0. injected power P | 1. AP | 2. A²P | 3. A³P |
4. betweenness centrality | 5. Katz centrality (networkx) | 6. degree centrality | 7. A𝔸 |
8. minimum neighbor degree | 9. maximum neighbor degree | 10. clustering coefficient | 11. A² 𝔸 |
12. closeness centrality | 13. load centrality (networkx) | 14. eigenvector centrality | 15. A³ 𝔸 |
16. second-order centrality (networkx) | 17. current-flow close centrality | 18. sparse sprout | 19. bulk |
20. harmonic centrality (networkx) | 21. square clustering (networkx) | 22. Fiedler eigenvector | 23. root |
24. resistance distance centrality | 25. current-flow betweenness centrality | 26. inner tree node | 27. proper leaf |
28. average neighbor degree | 29. connected to maximally loaded line | 30. degree assortativity | 31. graphlets |
32. average load of connected lines | 33. minimum load of connected lines | 34. P assortativity | 35. dense sprout |
36. random walk structural encoding | 37. maximum load of connected lines |
Name / Definition | Name / Definition | Name / Definition | Name / Definition |
---|---|---|---|
38. eccentricity (networkx) | 39. Kirchhoff index | 40. power sign ratio | 41. transitivity |
42. resistance distance Kirchhoff index | 43. inverse algebraic connectivity 1/λ₂ | 44. eigenratio λ₂/λₙ | 45. diameter |
46. maximal line load at operation point | 47. universal Kuramoto order parameter |
conda create -n nsgnn python=3.10
conda activate nsgnn
conda install pytorch=1.13 torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
conda install pyg=2.2 -c pyg -c conda-forge
pip install pyg-lib -f https://data.pyg.org/whl/torch-1.13.0+cu117.html
conda install openbabel fsspec rdkit -c conda-forge
pip install pytorch-lightning yacs torchmetrics
pip install tensorboardX
pip install ogb
conda clean --all
Our datasets are available on the drive and will be downloaded automatically when you execute our project. Our datasets including dataset20, dataset100, Texas, Spain, Germany, and France power grids.
Category | Dataset | Graphs | Total Nodes | Total Edges |
---|---|---|---|---|
SYN | Dataset20 | 10,000 | 200,000 | 538,188 |
Dataset100 | 10,000 | 1,000,000 | 2,857,882 | |
Real / Realistic | Texas | 1 | 1,910 | 5,154 |
France | 1 | 146 | 446 | |
Germany | 1 | 438 | 1,324 | |
Spain | 1 | 98 | 350 |
conda activate nsgnn
# Running NSGNN-F with GraphSAGE layer and random walk structural encoding for training on dataset20 and testing on Texas.
python main.py --cfg configs/NSGNN-F/SAGE-F-tr20teTexas-NRWSE.yaml
# Running NSGNN-F with TAGCN layer and the combination of measures encoding for training on dataset20 and testing on Texas.
python main.py --cfg configs/NSGNN-F/TAGCN-F-tr20teTexas-NetSci.yaml
# Running NSGNN-F with TAGCN layer and random walk structural encoding for training on dataset20 and testing on Texas.
python main.py --cfg configs/NSGNN-F/TAGCN-F-tr20teTexas-NRWSE.yaml
#Running NSGNN-F for only inference.
python main.py --cfg tests/NSGNN-F/TAGCN-F-tr100teTexas-NRWSE-inference.yaml
conda activate nsgnn
# Running NSGNN-S with ARMA layer with random walk structural encoding
python main.py --cfg configs/NSGNN-S/ARMA-S-tr100teTexas-NRWSE.yaml
# Running NSGNN-S with TAGCN layer with random walk structural encoding
python main.py --cfg configs/NSGNN-S/TAGCN-S-tr100teTexas-NRWSE.yaml
Performance comparison of SNBS prediction methods, quantified by the
- 🥇 First Place
- 🥈 Second Place
- 🥉 Third Place
Model | Method | tr20te100 | Tr20 Test Texas | Tr20 Test France | Tr20 Test Germany | Tr20 Test Spain | Tr100 Test Texas | Tr100 Test France | Tr100 Test Germany | Tr100 Test Spain |
---|---|---|---|---|---|---|---|---|---|---|
M1 | GCN | 58.24±0.47 | 50.17±0.36 | 60.67±1.27 | 63.50±0.35 | 22.47±1.18 | 48.56±1.02 | 77.36±1.08 | 79.31±0.74 | 65.25±1.21 |
GraphSAGE | 48.93±0.87 | 25.83±0.42 | 60.25±2.53 | 34.18±2.93 | 9.03±3.44 | 62.95±4.12 | 78.63±1.32 | 73.84±1.68 | 71.00±1.25 | |
ARMA | 67.12±0.80 | 52.50±2.68 | 57.36±1.14 | 75.60±0.21 | 16.73±9.75 | 63.95±2.27 | 88.69±1.22 | 90.84±0.20 | 71.12±3.26 | |
TAGCN | 66.32±0.74 | 66.36±1.34 | 64.08±2.07 | 72.11±0.67 | 41.47±0.83 | 83.31±1.46 | 90.47±0.53 | 91.09±0.21 | 83.47±1.26 | |
GraphGPS | 58.61±0.84 | 62.28±3.17 | 48.73±6.42 | 72.62±1.02 | 39.95±2.58 | 83.44±0.48 | 90.60±0.71 | 90.11±1.01 | 71.56±0.79 | |
EERM | 32.95±3.56 | 45.41±2.31 | 24.23±3.17 | 15.78±3.17 | 1.24±3.28 | 48.98±4.37 | 22.10±3.88 | 34.65±2.28 | 2.27±3.19 | |
GeneralGNN | 67.69±2.15 | 72.46±1.76 | 70.42±1.85 | 68.23±2.16 | 63.65±2.16 | 80.78±1.21 | 82.17±1.37 | 82.39±1.28 | 64.08±1.85 | |
M2 | Logreg | <0 | <0 | <0 | <0 | <0 | <0 | <0 | <0 | <0 |
MLP | 46.45±0.65 | 8.84±5.53 | 29.12±4.66 | 10.48±3.11 | <0 | 26.51±2.31 | 65.79±1.26 | 44.76±1.50 | 36.51±2.22 | |
GBR | 53.82±0.00 | 17.36±0.00 | 46.20±0.00 | 6.02±0.00 | <0 | 26.84±1.08 | 69.09±0.14 | 59.04±0.97 | 27.43±1.03 | |
GBC | 57.02±0.09 | <0 | 44.91±0.66 | 11.76±0.64 | 13.26±2.12 | <0 | 63.45±2.10 | 40.41±0.17 | 42.53±1.70 | |
Our | NSGNN-F (+RW) | 🥇 70.18±0.26 | 🥇 83.14±0.31 | 🥈 77.88±0.70 | 🥈 80.53±1.44 | 🥈 75.68±1.53 | 🥉 90.36±1.04 | 🥇 91.69±0.50 | 🥈 93.56±0.48 | 🥈 92.10±1.18 |
NSGNN-F (+Graphlets) | 67.33±1.02 | 55.42±5.13 | 74.92±0.82 | 72.39±1.94 | 🥇 78.79±0.55 | 🥇 91.18±0.22 | 90.61±1.05 🥉 | 92.98±0.20 | 🥇 92.86±1.05 | |
NSGNN-F (+MND+CC) | 🥉 68.35±0.46 | 77.58±1.27 | 🥇 78.54±0.90 | 🥇 81.38±0.63 | 🥉 72.96±0.43 | 🥈 90.45±0.30 | 🥈 91.59±0.58 | 🥉 93.42±0.79 | 🥉 86.62±1.30 | |
NSGNN-S (+RW) | 🥈 69.56±1.43 | 🥈 80.97±0.22 | 🥉 76.51±0.81 | 77.65±0.52 | 59.40±0.78 | 89.59±1.10 | 86.15±0.56 | 🥇 93.67±0.27 | 84.54±0.38 | |
NSGNN-S (+Graphlets) | 66.83±1.27 | 73.30±0.30 | 54.79±2.51 | 72.58±0.79 | 46.14±3.84 | 87.67±1.66 | 85.88±0.38 | 89.90±0.57 | 82.52±0.99 | |
NSGNN-S (+MND+CC) | 67.45±0.57 | 🥉 80.02±0.66 | 73.19±0.61 | 🥉 77.75±0.94 | 54.12±1.40 | 87.72±0.90 | 89.98±1.22 | 91.25±0.62 | 71.83±0.40 |