Generates the set of all possible binary networks of size n
.
powerset(n, directed = TRUE, force = FALSE, chunk_size = 2e+05)
n | Integer. Number of edges. |
---|---|
directed | Logical scalar. Whether to generate the power set of directed or undirected graphs, |
force | Logical scalar. When |
chunk_size | Number of matrices to process at a time. If n = 5, then
stack memory on the computer may overflow if |
powerset(2)#> [[1]] #> [,1] [,2] #> [1,] 0 0 #> [2,] 1 0 #> #> [[2]] #> [,1] [,2] #> [1,] 0 1 #> [2,] 1 0 #> #> [[3]] #> [,1] [,2] #> [1,] 0 1 #> [2,] 0 0 #> #> [[4]] #> [,1] [,2] #> [1,] 0 0 #> [2,] 0 0 #>powerset(4, directed = FALSE)#> [[1]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 0 0 #> [3,] 0 0 0 0 #> [4,] 0 0 0 0 #> #> [[2]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 0 0 #> [3,] 1 0 0 0 #> [4,] 0 0 0 0 #> #> [[3]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 0 0 #> [3,] 1 0 0 0 #> [4,] 0 0 0 0 #> #> [[4]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 0 0 #> [3,] 0 0 0 0 #> [4,] 1 0 0 0 #> #> [[5]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 0 0 #> [3,] 1 0 0 0 #> [4,] 1 0 0 0 #> #> [[6]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 0 0 #> [3,] 1 0 0 0 #> [4,] 1 0 0 0 #> #> [[7]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 0 0 #> [3,] 0 0 0 0 #> [4,] 1 0 0 0 #> #> [[8]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 1 0 #> [3,] 0 1 0 0 #> [4,] 0 0 0 0 #> #> [[9]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 1 0 #> [3,] 1 1 0 0 #> [4,] 0 0 0 0 #> #> [[10]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 1 0 #> [3,] 1 1 0 0 #> [4,] 0 0 0 0 #> #> [[11]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 1 0 #> [3,] 0 1 0 0 #> [4,] 1 0 0 0 #> #> [[12]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 1 0 #> [3,] 1 1 0 0 #> [4,] 1 0 0 0 #> #> [[13]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 1 0 #> [3,] 1 1 0 0 #> [4,] 1 0 0 0 #> #> [[14]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 1 0 #> [3,] 0 1 0 0 #> [4,] 1 0 0 0 #> #> [[15]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 1 0 #> [3,] 0 1 0 0 #> [4,] 0 0 0 0 #> #> [[16]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 0 1 #> [3,] 0 0 0 0 #> [4,] 0 1 0 0 #> #> [[17]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 0 1 #> [3,] 1 0 0 0 #> [4,] 0 1 0 0 #> #> [[18]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 0 1 #> [3,] 1 0 0 0 #> [4,] 0 1 0 0 #> #> [[19]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 0 1 #> [3,] 0 0 0 0 #> [4,] 1 1 0 0 #> #> [[20]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 0 1 #> [3,] 1 0 0 0 #> [4,] 1 1 0 0 #> #> [[21]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 0 1 #> [3,] 1 0 0 0 #> [4,] 1 1 0 0 #> #> [[22]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 0 1 #> [3,] 0 0 0 0 #> [4,] 1 1 0 0 #> #> [[23]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 1 1 #> [3,] 0 1 0 0 #> [4,] 0 1 0 0 #> #> [[24]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 1 1 #> [3,] 1 1 0 0 #> [4,] 0 1 0 0 #> #> [[25]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 1 1 #> [3,] 1 1 0 0 #> [4,] 0 1 0 0 #> #> [[26]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 1 1 #> [3,] 0 1 0 0 #> [4,] 1 1 0 0 #> #> [[27]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 1 1 #> [3,] 1 1 0 0 #> [4,] 1 1 0 0 #> #> [[28]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 1 1 #> [3,] 1 1 0 0 #> [4,] 1 1 0 0 #> #> [[29]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 1 1 #> [3,] 0 1 0 0 #> [4,] 1 1 0 0 #> #> [[30]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 1 1 #> [3,] 0 1 0 0 #> [4,] 0 1 0 0 #> #> [[31]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 0 1 #> [3,] 0 0 0 0 #> [4,] 0 1 0 0 #> #> [[32]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 0 0 #> [3,] 0 0 0 1 #> [4,] 0 0 1 0 #> #> [[33]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 0 0 #> [3,] 1 0 0 1 #> [4,] 0 0 1 0 #> #> [[34]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 0 0 #> [3,] 1 0 0 1 #> [4,] 0 0 1 0 #> #> [[35]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 0 0 #> [3,] 0 0 0 1 #> [4,] 1 0 1 0 #> #> [[36]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 0 0 #> [3,] 1 0 0 1 #> [4,] 1 0 1 0 #> #> [[37]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 0 0 #> [3,] 1 0 0 1 #> [4,] 1 0 1 0 #> #> [[38]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 0 0 #> [3,] 0 0 0 1 #> [4,] 1 0 1 0 #> #> [[39]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 1 0 #> [3,] 0 1 0 1 #> [4,] 0 0 1 0 #> #> [[40]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 1 0 #> [3,] 1 1 0 1 #> [4,] 0 0 1 0 #> #> [[41]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 1 0 #> [3,] 1 1 0 1 #> [4,] 0 0 1 0 #> #> [[42]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 1 0 #> [3,] 0 1 0 1 #> [4,] 1 0 1 0 #> #> [[43]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 1 0 #> [3,] 1 1 0 1 #> [4,] 1 0 1 0 #> #> [[44]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 1 0 #> [3,] 1 1 0 1 #> [4,] 1 0 1 0 #> #> [[45]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 1 0 #> [3,] 0 1 0 1 #> [4,] 1 0 1 0 #> #> [[46]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 1 0 #> [3,] 0 1 0 1 #> [4,] 0 0 1 0 #> #> [[47]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 0 1 #> [3,] 0 0 0 1 #> [4,] 0 1 1 0 #> #> [[48]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 0 1 #> [3,] 1 0 0 1 #> [4,] 0 1 1 0 #> #> [[49]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 0 1 #> [3,] 1 0 0 1 #> [4,] 0 1 1 0 #> #> [[50]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 0 1 #> [3,] 0 0 0 1 #> [4,] 1 1 1 0 #> #> [[51]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 0 1 #> [3,] 1 0 0 1 #> [4,] 1 1 1 0 #> #> [[52]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 0 1 #> [3,] 1 0 0 1 #> [4,] 1 1 1 0 #> #> [[53]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 0 1 #> [3,] 0 0 0 1 #> [4,] 1 1 1 0 #> #> [[54]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 0 #> [2,] 1 0 1 1 #> [3,] 0 1 0 1 #> [4,] 0 1 1 0 #> #> [[55]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 0 #> [2,] 1 0 1 1 #> [3,] 1 1 0 1 #> [4,] 0 1 1 0 #> #> [[56]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 0 #> [2,] 0 0 1 1 #> [3,] 1 1 0 1 #> [4,] 0 1 1 0 #> #> [[57]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 0 1 #> [2,] 1 0 1 1 #> [3,] 0 1 0 1 #> [4,] 1 1 1 0 #> #> [[58]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] 1 0 1 1 #> [3,] 1 1 0 1 #> [4,] 1 1 1 0 #> #> [[59]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 1 1 #> [2,] 0 0 1 1 #> [3,] 1 1 0 1 #> [4,] 1 1 1 0 #> #> [[60]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 1 #> [2,] 0 0 1 1 #> [3,] 0 1 0 1 #> [4,] 1 1 1 0 #> #> [[61]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 1 1 #> [3,] 0 1 0 1 #> [4,] 0 1 1 0 #> #> [[62]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 0 1 #> [3,] 0 0 0 1 #> [4,] 0 1 1 0 #> #> [[63]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 0 0 #> [3,] 0 0 0 1 #> [4,] 0 0 1 0 #> #> [[64]] #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> [2,] 0 0 0 0 #> [3,] 0 0 0 0 #> [4,] 0 0 0 0 #>