Created
October 4, 2016 08:08
-
-
Save bmtgoncalves/ae54cd70f9fd20d0bf013f6b384d4cfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ErdosRenyi(N, m=N): | |
net = np.zeros(2*m, dtype='int') | |
for i in xrange(m): | |
while True: | |
node1, node2 = np.random.randint(0, N, 2) | |
# No self loops allowed | |
if node1 != node2: | |
break | |
net[2*i] = node1 | |
net[2*i+1] = node2 | |
return net |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment