G = gsp_erdos_renyi( N,p,param ); G = gsp_erdos_renyi( N,p );
N | Number of nodes |
p | Probability of connection of a node with another |
param | Structure of optional parameter |
G | Graph structure. |
'gsp_erdos_renyi( N,p,param )' initializes create a graph structure containing the weighted adjacency matrix (G.W), the number of vertices (G.N) for an Erdos Renyi graph. All edge weights are equal to 1.
The Erdos Renyi graph is constructed by connecting nodes randomly. Each edge is included in the graph with probability p independent from every other edge.
param a Matlab structure containing the following fields:
- param.connected : flag to force the graph to be connected. By default, it is 0.
- param.maxit : is the maximum number of try to connect the graph. By default, it is 10.
- param.verbose : 0 no log, 1 print main steps, 2 print all steps. By default, it is 1.
Example:
G = gsp_erdos_renyi(100,0.05)