Sample a pair of correlated G(n,p) random graphs with correlation between
two graphs being corr
and edge probability being p
.
Arguments
- n
An integer. Number of total vertices for the sampled graphs.
- corr
A number. The target Pearson correlation between the adjacency matrices of the generated graphs. It must be in [0,1] interval.
- p
A number. Edge probability between two vertices. It must be in open [0,1] interval.
- ncore
An integer. Number of core vertices.
- permutation
A numeric vector to permute second graph.
- ...
Passed to
sample_gnp
.
Value
sample_correlated_gnp_pair
returns a list of two igraph object, named
graph1
and graph2
, whose adjacency matrix entries
are correlated with corr
. If sample two graphs with junk vertices, the first
ncore
vertices are core vertices and the rest are junk vertices.
References
V. Lyzinski and D. E. Fishkind and C. E. Priebe (2014), Seeded Graph Matching for Correlated Erdos-Renyi Graphs.J. Mach. Learn. Res., pages 3513-3540.
Examples
sample_correlated_gnp_pair(n=50, corr=0.3, p=0.5, ncore=40)
#> $graph1
#> IGRAPH 6dfc2ef U--- 50 607 --
#> + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l), type
#> | (g/c), p (g/n)
#> + edges from 6dfc2ef:
#> [1] 49--50 46--50 46--48 46--47 45--50 45--49 45--48 45--46 44--50 44--49
#> [11] 44--47 44--46 43--50 43--49 43--48 43--47 43--45 43--44 42--50 42--49
#> [21] 42--48 42--46 42--44 42--43 41--50 41--45 41--42 40--49 40--47 40--43
#> [31] 40--42 39--50 39--48 39--44 39--43 38--50 38--48 38--46 38--45 38--43
#> [41] 38--41 38--40 37--50 37--49 37--48 37--47 37--45 37--39 37--38 36--48
#> [51] 36--47 36--41 36--40 36--39 36--38 36--37 35--50 35--49 35--47 35--45
#> [61] 35--44 35--41 35--40 35--36 34--49 34--47 34--46 34--45 34--43 34--42
#> + ... omitted several edges
#>
#> $graph2
#> IGRAPH 75fbb57 U--- 50 614 --
#> + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l),
#> | type_1 (g/c), type_2 (g/c), p_1 (g/n), p_2 (g/n), type (g/c), p (g/n)
#> + edges from 75fbb57:
#> [1] 48--50 48--49 46--50 45--50 45--49 45--47 45--46 44--47 44--46 44--45
#> [11] 43--49 43--48 43--47 43--46 43--45 42--50 42--46 41--49 41--46 41--45
#> [21] 41--44 41--42 40--50 40--47 40--45 40--44 40--43 40--42 39--50 39--48
#> [31] 39--47 39--46 39--45 39--43 39--42 39--41 38--50 38--49 38--47 38--46
#> [41] 38--44 38--40 37--50 37--41 37--40 37--39 36--50 36--48 36--47 36--46
#> [51] 36--44 36--42 36--40 36--38 36--37 35--50 35--48 35--42 35--41 35--40
#> [61] 35--39 34--48 34--47 34--46 34--43 34--41 34--38 34--35 33--49 33--48
#> + ... omitted several edges
#>
sample_correlated_gnp_pair(n=5, corr=0.3, p=0.5, permutation=c(1,3,2,4,5))
#> $graph1
#> IGRAPH dd2876c U--- 5 6 -- Erdos-Renyi (gnp) graph
#> + attr: name (g/c), type (g/c), loops (g/l), p (g/n)
#> + edges from dd2876c:
#> [1] 1--2 1--3 2--3 2--4 2--5 4--5
#>
#> $graph2
#> IGRAPH eea4890 U--- 5 6 -- Erdos-Renyi (gnp) graph
#> + attr: name_1 (g/c), name_2 (g/c), type_1 (g/c), type_2 (g/c), loops_1
#> | (g/l), loops_2 (g/l), p_1 (g/n), p_2 (g/n), name (g/c), type (g/c),
#> | loops (g/l), p (g/n)
#> + edges from eea4890:
#> [1] 4--5 3--5 3--4 2--3 1--2 1--3
#>