ER_SPG: Synthetic Power Graph generation by Erdos-Renyi Model

Citation Author(s):
Golestan University
Submitted by:
Mohammad Shahraeini
Last updated:
Mon, 12/25/2023 - 01:53
Data Format:
Research Article Link:
0 ratings - Please login to submit your rating.


ER-SPG is a Matlab code for producing synthetic power graphs using well-known Erdos-Renyi Random Model. It scales power graphs and achieves connectivity in each scale by different approach, and accordingly connected graphs with average degree between 2 to 5 (normally between 2.3 to 3.1) can be produced by ER_SPG with the structures similar to power graphs. It also reorders the graph vertices to obtain consecutive numbering similar to power graphs. This algorithm is also provides locations of zero injection buses (ZIBs) as operational data of power graphs. The produced graph expressed by adjacency matrix A, and ZIB location expressed by vector Z. The produced data can be used in Optimal PMU Placement (OPP) problem, which locates PMUs for system observability in vector X. The previously produced A and Z matrices and vectors and their related X vectors reported in Table II of the paper are also available in this data set. The Matlab code also includes a function, which can represent power graphs by Kirk circle. The location of ZIBs and PMUs are also can be presented in this type of representation.

Important note: This algorithm uses some functions and routines of “Octave Networks Toolbox” developed by “MIT Strategic Engineering”:



1) ER_SPG: generating synthetic power grids using Erdos-Renyi (Erdos or Gilbert Models)


Unzip the ER_SPG.rar file.


It contains 3 Matlab .m files: ER-SPG.m, orderinc.m and KirkPG.m, and two folders named “octave” and "AZX", which respectively contains all required octave functions and results of Table II in the mentioned article.


Algorithm Input and Outputs





        mode: random graph model ( 'erdos' or 'gilbert' )

        n : graph size

        M : no. of edges

        p : Gilbert porobability

        nz : number of Zero Injection Buses (ZIBs) 



       adj : adjacency matrix of generated power graph

       Z : ZIB vector


Mandatory Inputs:

       mode and n


Example 1: 


Generates a synthetic power graph with size of 100 with G(n,M) model and stored in A. M is synthesized in the accepted range of power graphs.


Example 2:


Generates a synthetic power graph with the size of 200 with G(n,p=0.2) model stored in A. M is ignored in ‘gilbert’ mode. Number of ZIBs is 50 and stored in Z.


2) A, Z, and X of Table II

Table II of the paper provides 3 IEEE cases, 3 real cases, and synthesization of graph with n=1000. For each case, 3 similar synthetic graphs are produced by proposed ‘erdos’, proposed ‘gilber’, and syngrid model published in Matpower 0.7. A matrix, Z vector and their related X vector of each case and SPGs are separately stored in separate .mat files all compressed in file.


3) KirkPG: Visualization of power graph with Kirk circle representation

This function generates a Kirk plot representation of a power graph using the specified adjacency matrix, ZIB locations, and PMU placement. The strategy used in the function is to position the vertices of the graph in a regular n-polygon. The function is a modified version of the “drawCircGraph.m” octave toolbox.

Important note: It is recommended for networks with a size below 100.



- adj: nxn adjacency matrix

- Z: nx1 ZIB vector

- X: nx1 PMU vector



- Kirk plot of the power graph



From, load 57Erdos.mat


In order to repeat Fig. 5.c run: