
Separates the dense and sparse part from a (U,W) graphon mixture
separate_dense_and_sparse.RdThis function breaks a (U,W) mixture graph into a dense and sparse component.
Value
a list with the following components:
gr_denseThe dense component.
gr_sparseThe sparse component.
dataThe original graph.
Examples
library(igraph)
W <- matrix(0.1, nrow = 100, ncol = 100)
wts <- c(0.5, 0.3, 0.2)
ns <- 200
nd <- 100
p <- 0.5
gr <- sample_mixed_graph(W, wts, nd, ns, p = 0.1, option = 2)
out <- separate_dense_and_sparse(gr)
out
#> $dense_part
#> IGRAPH 24e2f35 U--- 92 453 -- Star
#> + attr: name_1 (g/c), name_2 (g/c), mode_1 (g/c), mode_2 (g/c),
#> | center_1 (g/n), center_2 (g/n), name (g/c), mode (g/c), center (g/n)
#> + edges from 24e2f35:
#> [1] 1-- 4 3-- 9 6--10 4--11 7--12 11--13 1--14 7--14 11--14 6--15
#> [11] 8--15 2--16 8--17 9--17 1--18 2--18 4--18 8--19 3--20 4--20
#> [21] 12--20 15--20 11--21 12--21 19--21 21--22 10--23 14--23 16--23 18--23
#> [31] 22--23 1--24 4--24 16--24 4--25 9--25 17--25 19--25 23--25 24--25
#> [41] 8--26 22--26 25--26 5--27 8--27 21--27 26--27 5--28 10--28 4--30
#> [51] 25--30 5--31 24--31 26--31 5--32 29--32 11--33 32--33 6--34 16--34
#> [61] 20--34 26--34 8--35 18--35 23--35 25--35 34--35 15--36 18--36 25--36
#> + ... omitted several edges
#>
#> $sparse_part
#> IGRAPH c2bb9d9 U--- 197 194 -- Star
#> + attr: name_1 (g/c), name_2 (g/c), mode_1 (g/c), mode_2 (g/c),
#> | center_1 (g/n), center_2 (g/n), name (g/c), mode (g/c), center (g/n)
#> + edges from c2bb9d9:
#> [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 1--11 1--12 1--13
#> [13] 1--14 1--15 1--16 1--17 1--18 1--19 1--20 1--21 1--22 1--23 1--24 1--25
#> [25] 1--26 1--27 1--28 1--29 1--30 1--31 1--32 1--33 1--34 1--35 1--36 1--37
#> [37] 1--38 1--39 1--40 1--41 1--42 1--43 1--44 1--45 1--46 1--47 1--48 1--49
#> [49] 1--50 1--51 1--52 1--53 1--54 1--55 1--56 1--57 1--58 1--59 1--60 1--61
#> [61] 1--62 1--63 1--64 1--65 1--66 1--67 1--68 1--69 1--70 1--71 1--72 1--73
#> [73] 1--74 1--75 1--76 1--77 1--78 1--79 1--80 1--81 1--82 1--83 1--84 1--85
#> + ... omitted several edges
#>
#> $data
#> IGRAPH f2cbd45 U--- 300 722 -- Star
#> + attr: name_1 (g/c), name_2 (g/c), mode_1 (g/c), mode_2 (g/c),
#> | center_1 (g/n), center_2 (g/n), name (g/c), mode (g/c), center (g/n)
#> + edges from f2cbd45:
#> [1] 1-- 5 1-- 12 1-- 17 1-- 21 1-- 28 1-- 35 1-- 42 1-- 43 1-- 57 1-- 68
#> [11] 1-- 87 2-- 19 2-- 21 2-- 42 2-- 65 2-- 73 2-- 83 2-- 84 2-- 88 2-- 98
#> [21] 3-- 16 3-- 36 3-- 58 3-- 77 3-- 92 4-- 10 4-- 12 4-- 24 4-- 49 4-- 60
#> [31] 4-- 89 4-- 90 4-- 95 4-- 97 5-- 13 5-- 21 5-- 24 5-- 28 5-- 29 5-- 34
#> [41] 5-- 49 5-- 51 5-- 58 5-- 65 5-- 68 5-- 72 5-- 73 5-- 96 6-- 12 6-- 31
#> [51] 6-- 32 6-- 36 6-- 37 6-- 59 6-- 71 6-- 99 7-- 11 7-- 18 7-- 39 7-- 56
#> [61] 7-- 73 7-- 78 7-- 84 7-- 95 8-- 15 8-- 17 8-- 42 8-- 48 8-- 53 8-- 68
#> + ... omitted several edges
#>
#> $fitlines
#> $fitlines$num_hubs
#> [1] 3
#>
#> $fitlines$dense_limit
#> [1] 15
#>
#> $fitlines$cutoffs
#> [1] 3 15
#>
#> $fitlines$segment_sizes
#> [1] 3 12 5
#>
#> $fitlines$elbow_points
#> [1] 3 15
#>
#> $fitlines$line_equations
#> [1] "y = -0.4508 * x + 5.0481" "y = -0.0877 * x + 3.4262"
#> [3] "y = -0.2100 * x + 5.3465"
#>
#> $fitlines$models
#> $fitlines$models[[1]]
#>
#> Call:
#> lm(formula = y ~ x, data = df[1:i, ])
#>
#> Coefficients:
#> (Intercept) x
#> 5.0481 -0.4508
#>
#>
#> $fitlines$models[[2]]
#>
#> Call:
#> lm(formula = y ~ x, data = df[(i + 1):j, ])
#>
#> Coefficients:
#> (Intercept) x
#> 3.42619 -0.08771
#>
#>
#> $fitlines$models[[3]]
#>
#> Call:
#> lm(formula = y ~ x, data = df[(j + 1):n, ])
#>
#> Coefficients:
#> (Intercept) x
#> 5.347 -0.210
#>
#>
#>
#> $fitlines$mse
#> [1] 0.001061361
#>
#> $fitlines$data
#> x y
#> 1 1 4.615121
#> 2 2 4.110874
#> 3 3 3.713572
#> 4 4 3.091042
#> 5 5 3.044522
#> 6 6 2.833213
#> 7 7 2.772589
#> 8 8 2.708050
#> 9 9 2.639057
#> 10 10 2.564949
#> 11 11 2.484907
#> 12 12 2.397895
#> 13 13 2.302585
#> 14 14 2.197225
#> 15 15 2.079442
#> 16 16 1.945910
#> 17 17 1.791759
#> 18 18 1.609438
#> 19 19 1.386294
#> 20 20 1.098612
#>
#> $fitlines$phat
#> [1] 0.5025381 0.2994924 0.1979695
#>
#> $fitlines$dense_part
#> IGRAPH df41408 U--- 92 453 -- Star
#> + attr: name_1 (g/c), name_2 (g/c), mode_1 (g/c), mode_2 (g/c),
#> | center_1 (g/n), center_2 (g/n), name (g/c), mode (g/c), center (g/n)
#> + edges from df41408:
#> [1] 1-- 4 3-- 9 6--10 4--11 7--12 11--13 1--14 7--14 11--14 6--15
#> [11] 8--15 2--16 8--17 9--17 1--18 2--18 4--18 8--19 3--20 4--20
#> [21] 12--20 15--20 11--21 12--21 19--21 21--22 10--23 14--23 16--23 18--23
#> [31] 22--23 1--24 4--24 16--24 4--25 9--25 17--25 19--25 23--25 24--25
#> [41] 8--26 22--26 25--26 5--27 8--27 21--27 26--27 5--28 10--28 4--30
#> [51] 25--30 5--31 24--31 26--31 5--32 29--32 11--33 32--33 6--34 16--34
#> [61] 20--34 26--34 8--35 18--35 23--35 25--35 34--35 15--36 18--36 25--36
#> + ... omitted several edges
#>
#>
#> $call
#> separate_dense_and_sparse(grmix = gr)
#>
#> attr(,"class")
#> [1] "separate_dense_and_sparse"