No BSD License  

Highlights from
Erdos-Renyi Random Graph

4.5

4.5 | 6 ratings Rate this file 17 Downloads (last 30 days) File Size: 2.86 KB File ID: #4206
image thumbnail

Erdos-Renyi Random Graph

by Pablo Blinder

 

01 Dec 2003 (Updated 25 Jan 2005)

Random graph generation.

| Watch this File

File Information
Description

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):
>>G=erdosRenyi(40,0.01,4);

To see display the graph issue:
>>plotGraphBasic(G,6,1);

6 is the marker size. 1 tells function to add labels (0 disables labbeling)

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
24 Mar 2005 lizhen you  
17 May 2005 roger lin  
04 Oct 2005 LIU Jie

GOOD

29 Apr 2007 ziqiang zuo

it is a good routine, but in the processof reconncetion, it permites a vertex to connect itself. To avoid this, I change the code :
 vToRec=nonAdj(ceil(rand*length(nonAdj))); to
 vToRec=vDisToRec;
    while vToRec==vDisToRec
          vToRec=nonAdj(ceil(rand*length(nonAdj)));
    end

20 Aug 2009 David

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:
replace
A=A+fliplr((flipud(triu(A))));
with
A=A+A';

26 May 2011 A.Y.

Good and working implementation. Might have been better if plotting function supports curved edges.

Please login to add a comment or rating.
Updates
25 Jan 2005

Major changes
i) stablish initial node degree for the regular lattice.
ii) Implements new data structure for storing graph.
iii) Bug fixed: missing vertex in display

Tag Activity for this File
Tag Applied By Date/Time
random Pablo Blinder 22 Oct 2008 07:10:04
graphs Pablo Blinder 22 Oct 2008 07:10:04
graph theory Pablo Blinder 22 Oct 2008 07:10:04
general Pablo Blinder 22 Oct 2008 07:10:04
mathematics Pablo Blinder 22 Oct 2008 07:10:04
random Nir 24 Jun 2009 09:01:07
graph theory Nir 24 Jun 2009 09:01:12

Contact us at files@mathworks.com