Generates a random network with a probabilistic community structure
a vector, the number of communities equals the number of vertices in this vector.
a vector of probability of a vertex to be randomly linked to other vertices in the same community.
the probability of a vertex to be randomly linked to vertices in other communities.
the proportion of links that are randomly deleted.
output class, either "igraph" (default), "network", or "matrix"
a graph with the given community structure
The researcher specifies the size of each community and the probabilities of vertices within each community. In addition, there is an overall probability of edges between vertices of different communities and a specified fraction of edges is removed from the graph.
The internal code is largely based upon network.simu
,
in the wfg package, which
implements simulation of networks under the framework by Girvan and Newman.
create_community_graph(graph = "matrix")
#> $graph
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#> [1,] 0 0 0 0 0 0 0 1 1 1 0 0 0
#> [2,] 0 0 0 0 0 1 0 0 0 0 0 1 0
#> [3,] 0 0 0 0 1 0 0 1 0 1 0 0 0
#> [4,] 0 0 0 0 0 1 0 1 0 0 0 0 0
#> [5,] 0 0 1 0 0 0 1 0 0 1 0 0 0
#> [6,] 0 1 0 1 0 0 0 1 0 0 0 0 0
#> [7,] 0 0 0 0 1 0 0 0 0 0 0 0 0
#> [8,] 1 0 1 1 0 1 0 0 1 1 1 0 0
#> [9,] 1 0 0 0 0 0 0 1 0 0 0 0 1
#> [10,] 1 0 1 0 1 0 0 1 0 0 1 1 1
#> [11,] 0 0 0 0 0 0 0 1 0 1 0 1 0
#> [12,] 0 1 0 0 0 0 0 0 0 1 1 0 0
#> [13,] 0 0 0 0 0 0 0 0 1 1 0 0 0
#> [14,] 0 1 1 0 0 0 0 0 0 0 0 0 0
#> [15,] 0 0 0 0 0 1 0 0 1 1 0 0 0
#> [16,] 0 0 1 0 0 1 0 0 1 0 0 0 0
#> [17,] 0 0 1 1 0 0 0 1 0 0 0 0 0
#> [18,] 0 0 0 0 1 0 0 0 0 0 1 0 1
#> [19,] 0 0 0 0 0 1 0 1 1 0 0 1 0
#> [20,] 0 0 0 0 1 0 1 0 0 1 0 1 0
#> [21,] 0 0 0 0 0 0 1 0 1 0 0 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1 1 1 1 0
#> [40,] 1 1 0 0 1 0 0 0 0 0 0
#> [41,] 1 1 0 1 0 1 1 1 0 0 0
#> [42,] 0 1 0 1 0 0 0 0 0 0 1
#> [43,] 0 0 0 1 0 0 0 0 0 0 0
#> [44,] 0 0 0 0 0 0 0 0 1 0 0
#> [45,] 0 0 1 0 0 0 0 0 1 0 0
#> [46,] 0 0 1 1 1 0 0 1 0 1 1
#> [47,] 1 1 1 1 0 1 0 0 1 1 0
#> [48,] 1 0 0 1 1 1 0 0 1 1 0
#> [49,] 1 0 0 0 1 0 0 0 1 0 0
#> [50,] 0 0 1 0 1 1 1 0 1 0 0
#> [51,] 0 0 1 0 0 0 0 1 0 0 0
#> [52,] 1 1 0 0 0 0 0 0 1 0 0
#> [53,] 0 0 0 0 0 0 0 1 0 1 0
#> [54,] 1 0 0 0 0 0 0 1 0 0 0
#> [55,] 1 0 0 0 0 0 0 0 0 0 0
#> [56,] 1 0 0 0 0 0 0 0 0 0 1
#> [57,] 0 1 0 1 1 0 0 0 0 0 0
#> [58,] 1 0 1 0 0 0 0 0 0 0 0
#> [59,] 0 0 0 1 0 0 0 0 0 0 1
#> [60,] 0 0 0 0 0 0 1 0 0 1 0
#>
#> $group
#> [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3
#> [39] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
#>
create_community_graph(c(10, 10, 15), p_intra = c(.25, .35, .45),
p_inter = .2, p_del = .2, graph = "network")
#> $graph
#> Network attributes:
#> vertices = 35
#> directed = FALSE
#> hyper = FALSE
#> loops = FALSE
#> multiple = FALSE
#> bipartite = FALSE
#> total edges= 112
#> missing edges= 0
#> non-missing edges= 112
#>
#> Vertex attribute names:
#> vertex.names
#>
#> No edge attributes
#>
#> $group
#> [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
#>
create_community_graph(c(30, 30, 30), p_intra = c(.4, .2, .15),
p_inter = .4, p_del = .4)
#> $graph
#> IGRAPH c7d0216 U--- 90 836 --
#> + edges from c7d0216:
#> [1] 1-- 2 1-- 4 1-- 5 1-- 6 1--10 1--15 1--19 1--26 1--27 1--30 1--32 1--35
#> [13] 1--38 1--40 1--41 1--44 1--46 1--49 1--51 1--55 1--58 1--61 1--65 1--70
#> [25] 1--72 1--79 1--85 1--86 1--87 2-- 8 2--12 2--16 2--18 2--19 2--21 2--24
#> [37] 2--28 2--31 2--32 2--38 2--40 2--44 2--48 2--55 2--69 2--72 2--78 2--80
#> [49] 2--82 2--85 2--89 3--11 3--17 3--24 3--31 3--33 3--34 3--35 3--37 3--39
#> [61] 3--40 3--42 3--45 3--47 3--48 3--49 3--50 3--53 3--54 3--55 3--58 3--63
#> [73] 3--64 3--65 3--66 3--75 3--76 3--78 3--82 4-- 5 4-- 9 4--12 4--15 4--21
#> [85] 4--23 4--26 4--28 4--31 4--37 4--46 4--50 4--51 4--57 4--60 4--62 4--63
#> [97] 4--70 4--74 4--77 4--79 4--81 4--83 5--15 5--16 5--19 5--24 5--28 5--39
#> + ... omitted several edges
#>
#> $group
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2
#> [39] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
#> [77] 3 3 3 3 3 3 3 3 3 3 3 3 3 3
#>
if (FALSE) { # \dontrun{
g <- create_community_graph(c(5, 5, 5), p_intra = c(.75, .75, .70),
p_inter = .15, p_del = .2)
g$graph <- snafun::add_vertex_attributes(g$graph, "color", g$group)
snafun::plot(g$graph)
} # }