The Erdos-Renyi (Erdos and Renyi, 1959) is the first ever proposed algorithm for the formation of random graphs. It selects with equal probability pairs of nodes from the graph set of nodes and connects them with a predefined probability.
To rewire, with probability (p=0.01) a 100 vertex regular graph (vertex deg=4):
To see display the graph issue:
6 is the marker size. 1 tells function to add labels (0 disables labbeling)
I agree with Fabio and Enrico. The code generates WS networks with rewiring probability p.
Nice function, but it I agree with Fabio:
it will generate SMALL WORLD (Watts and Strogatz, WS) networks and NOT Erdos-Renyi random graphs.
how can I determine the intersection of two edges as a point in Erdos-Renyi Random Graph?
The title is completely misleading. It does not generate Erdos-Renyi Random Networks, but Watts-Strogatz Random Networks.
They are always single scale networks, but the degree distribution is not a Poisson.
As mentioned before this does not properly make the matrix symmetric nor does it prevent nodes from being linked to themselves.
Symmetric: David is correct. This is a good fix.
Self linking: not sold on ziqiang zuo's fix. I added a line after the creation of A to read
and one just before the creation of G reading:
This works because the diagonal will not be added to the list of disconnected nodes.
Otherwise, everything looks good!
Good and working implementation. Might have been better if plotting function supports curved edges.
Also the last line does not make the matrix symmetric. SInce you work on the upper triangle of the matrix, the easiest way to make the matrix symmetric is:
it is a good routine, but in the processof reconncetion, it permites a vertex to connect itself. To avoid this, I change the code :