File: test-centralization.R

package info (click to toggle)
r-cran-igraph 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 27,772 kB
  • sloc: ansic: 206,420; cpp: 21,827; fortran: 4,090; yacc: 1,229; lex: 518; sh: 52; makefile: 8
file content (28 lines) | stat: -rw-r--r-- 849 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
test_that("centr_degree works", {
  g <- make_star(5, "undirected")
  g_centr <- centr_degree(g, normalized = FALSE)
  g_centr_tmax <- centr_degree_tmax(g, loops = FALSE)
  expect_equal(g_centr$centralization, g_centr_tmax)
})

test_that("centr_betw works", {
  g <- make_star(5, "undirected")
  g_centr <- centr_betw(g, normalized = FALSE)
  g_centr_tmax <- centr_betw_tmax(g)
  expect_equal(g_centr$centralization, g_centr_tmax)
})

test_that("centr_clo works", {
  g <- make_star(5, "undirected")
  g_centr <- centr_clo(g, normalized = FALSE)
  g_centr_tmax <- centr_clo_tmax(g)
  expect_equal(g_centr$centralization, g_centr_tmax)
})


test_that("centr_eigen works", {
  g <- make_star(2, "undirected")
  g_centr <- centr_eigen(g, normalized = FALSE)
  g_centr_tmax <- centr_eigen_tmax(g)
  expect_equal(g_centr$centralization, g_centr_tmax)
})