context("regular graph generation")
library(graphR)
# test --------------------------------------------------------------------
test_that("Returned matrix has correct degree distribution", {
# params
N <- 20
k <- 4
degree_dist <- rep(k, N)
# generate graph with R
graph <- regular_matrix(N, k)
# calculate degree distribution
graph_dist <- rowSums(graph)
# expect
expect_equal(degree_dist, graph_dist)
})
# test --------------------------------------------------------------------
test_that("Returned list has correct degree distribution", {
# params
N <- 20
k <- 4
degree_dist <- rep(k, N)
# generate graph
graph <- regular_list(N, k)
# calculate degree distribution
graph_dist <- unlist(lapply(graph, length))
# expect
expect_equal(degree_dist, graph_dist)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.