Simulates an Erdös-Renyi graph
erdos(p, prob)
p | number of nodes |
---|---|
prob | probability for an edge, which is the same for all edges |
the adjacency matrix
erdos(10,0.3)#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 0 0 0 1 0 0 0 1 0 1 #> [2,] 0 0 0 0 0 0 0 0 1 0 #> [3,] 0 0 0 0 1 0 1 0 0 1 #> [4,] 1 0 0 0 0 0 0 0 0 1 #> [5,] 0 0 1 0 0 0 0 0 0 0 #> [6,] 0 0 0 0 0 0 0 1 0 0 #> [7,] 0 0 1 0 0 0 0 1 1 1 #> [8,] 1 0 0 0 0 1 1 0 1 0 #> [9,] 0 1 0 0 0 0 1 1 0 0 #> [10,] 1 0 1 1 0 0 1 0 0 0