Skip to content

fastRG::sbm without setting expected_degree is doubling the number of edges that should be there.  #19

@karlrohe

Description

@karlrohe
library(fastRG)
library(magrittr)

n = 1000
pop = n/2
a = .1
b = .05
B = matrix(c(a,b,b,a), nrow = 2)
b_model = fastRG::sbm(n = n, k =2, 
                          B = B,  edge_distribution = "bernoulli")

b_model %>% 
  sample_sparse(poisson_edges = F) %>% 
  rowSums %>% mean

pop*a + pop*b  # this should be average degree

Dividing B by two fixes the problem:

b_model = fastRG::sbm(n = n, k =2, 
                          B = B/2,  edge_distribution = "bernoulli")

b_model %>% 
  sample_sparse(poisson_edges = F) %>% 
  rowSums %>% mean

Perhaps we are symmetrizing the edges at some point... this would double the number of edges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions