Random Bernoulli graph
rbernoulli(n, p = 0.5)
n | Integer vector. Size of the graph. If |
---|---|
p | Probability of a tie. This may be either a scalar, or a vector of the
same length of |
If n
is a single number, a square matrix of size n
with zeros in
the diagonal. Otherwise it returns a list of length(n)
square matrices of
sizes equal to those specified in n
.
# A graph of size 4 rbernoulli(4)#> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 0 0 1 1 #> [3,] 0 0 0 0 #> [4,] 0 1 1 0#> [[1]] #> [,1] [,2] [,3] #> [1,] 0 0 0 #> [2,] 1 0 0 #> [3,] 0 1 0 #> #> [[2]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 1 1 #> [3,] 0 1 0 0 #> [4,] 1 1 1 0 #> #> [[3]] #> [,1] [,2] #> [1,] 0 1 #> [2,] 1 0 #>#> [[1]] #> [,1] [,2] [,3] #> [1,] 0 0 0 #> [2,] 0 0 0 #> [3,] 0 0 0 #> #> [[2]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 0 0 #> [3,] 1 0 0 0 #> [4,] 1 0 0 0 #> #> [[3]] #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 0 1 0 0 0 1 #> [2,] 0 0 1 0 1 0 #> [3,] 0 0 0 0 1 1 #> [4,] 0 0 0 0 0 0 #> [5,] 1 0 0 0 0 0 #> [6,] 0 0 0 1 0 0 #>