
Samples a graph from a graphette
sample_graphette.RdSamples a graph from a graphette given by (W, a_n, f), where W is the graphon, a_n is generally a sequence converging to zero and f is a graph edit funcion.
Usage
sample_graphette(
W,
rho_n = NULL,
graph_edit_f = NULL,
n = 100,
t_or_p = 0.5,
ring_sizes = c(5, 6)
)Arguments
- W
The graphon. This is a symmetric matrix with values in [0,1]
- rho_n
A function. Default is 1.
- graph_edit_f
The graph edit function. For star functions it can be one of
'star_f1','star_f2','star_f3','star_f4'or'star_f5'. To add rings, it needs to be'add_rings'. The function'remove_cycles'removes cycles.- n
The number of nodes in the graph to sample
- t_or_p
The parameter for star function or the ring function. For the ring function it needs to be between 0 and 1.
- ring_sizes
The size of rings to add if the graph edit function is the ring function. default values set to
c(5,6).
Examples
library(igraph)
# Example 1
f1 <- function(n) 10/n
W <- matrix(0.2, nrow = 100, ncol = 100)
gr <- sample_graphette(W, rho_n = f1, graph_edit_f = 'add_rings', n = 100, t_or_p = 0.5)
gr
#> IGRAPH d3ccf16 U--- 377 432 --
#> + attr: name_1 (g/c), name_2 (g/c), mutual_1 (g/l), mutual_2 (g/l),
#> | circular_1 (g/l), circular_2 (g/l)
#> + edges from d3ccf16:
#> [1] 1-- 9 2-- 8 2-- 36 3-- 7 3-- 18 3-- 53 3-- 93 4-- 72 4-- 84
#> [10] 5-- 19 5-- 59 5-- 81 6-- 32 6-- 99 7-- 31 8-- 85 8-- 91 9-- 33
#> [19] 10-- 24 10-- 58 10-- 73 12-- 67 12-- 81 12-- 93 13-- 73 13-- 81 13--100
#> [28] 14-- 56 14-- 58 14-- 73 15-- 21 15-- 47 15-- 70 17-- 36 17-- 44 17-- 67
#> [37] 17-- 88 18-- 27 18-- 55 18-- 71 19-- 69 19-- 90 20-- 40 20-- 60 22-- 95
#> [46] 23-- 86 24-- 46 24-- 71 26-- 31 26-- 81 26-- 99 28-- 94 29-- 99 30-- 95
#> [55] 32-- 81 35-- 52 35-- 90 35-- 92 35-- 97 36-- 63 37-- 68 37-- 88 40-- 47
#> + ... omitted several edges
# Example 2
gr <- sample_graphette(W, rho_n = f1, graph_edit_f = 'star_f1', n = 100, t_or_p = 3)
gr
#> IGRAPH 4c7cca3 U--- 161 156 --
#> + edges from 4c7cca3:
#> [1] 2-- 6 2-- 29 3-- 25 3-- 27 3-- 44 3-- 64 3-- 72 3-- 76 4-- 10
#> [10] 4-- 15 5-- 8 7-- 52 9-- 37 9-- 50 10-- 95 11-- 35 11-- 93 12-- 80
#> [19] 12-- 96 12-- 98 13-- 20 14-- 34 14-- 52 14-- 65 14-- 87 15-- 25 15-- 80
#> [28] 15-- 84 16-- 38 17-- 81 18-- 29 19-- 52 19-- 58 19-- 72 20-- 75 21-- 56
#> [37] 21-- 60 21-- 71 21-- 78 22-- 98 24-- 77 25-- 38 25-- 42 25-- 45 25-- 88
#> [46] 26-- 56 27-- 71 28-- 45 29-- 37 29-- 66 30-- 85 32-- 48 32-- 87 33-- 82
#> [55] 35-- 71 37-- 90 38-- 39 39-- 90 41-- 42 41-- 92 41--100 42-- 74 42-- 94
#> [64] 44-- 55 44-- 76 45-- 79 45-- 99 46-- 75 47-- 65 48-- 96 49--100 50-- 80
#> [73] 51-- 87 51-- 91 52-- 60 52-- 66 53-- 60 54-- 85 55-- 56 55-- 98 57-- 77
#> + ... omitted several edges