tests/testthat/test-mentor.r

context("Mentor matching")

# ------------------------------------------------------------------------------
test_that("Mentor matching", {
  set.seed(1)

  g <- igraph::make_graph(~1--2,1--3,1--4,4--5,6)
  g <- igraph::as_adj(g)

  ans <- mentor_matching(g, 2)
  expect_equal(sort(unique(ans$match)), as.character(c(1,4)))
})


# ------------------------------------------------------------------------------
test_that("Plot mentor", {
  set.seed(1)

  g <- igraph::make_graph(~1--2,1--3,1--4,4--5,6)
  g <- igraph::as_adj(g)
  ans <- mentor_matching(g, 2)

  expect_silent(plot(ans))
})

Try the netdiffuseR package in your browser

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

netdiffuseR documentation built on June 7, 2018, 5:05 p.m.