tests/testthat/test-undirected-sbms.R

test_that("SBMs don't drop isolated nodes", {

  set.seed(27)

  n <- 10
  k <- 10
  pi <- rep(1, k) / k

  B <- diag(rep(0.5, k))

  sbm <- sbm(n = n, pi = pi, B = B)

  A <- sample_sparse(sbm)

  expect_equal(ncol(A), 10)
  expect_equal(nrow(A), 10)
})

test_that("rank 1 sbms sample", {

  set.seed(27)

  n <- 10
  k <- 1
  pi <- rep(1, k) / k

  B <- matrix(0.5)

  sbm <- sbm(n = n, pi = pi, B = B)

  expect_silent(A <- sample_sparse(sbm))
})

Try the fastRG package in your browser

Any scripts or data that you put into this service are public.

fastRG documentation built on Aug. 22, 2023, 1:08 a.m.