/usr/lib/R/site-library/igraph/tests/test_edge.betweenness.community.R is in r-cran-igraph 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | context("edge.betweenness.community")
test_that("edge.betweenness.community works", {
library(igraph)
g <- graph.famous("Zachary")
ebc <- edge.betweenness.community(g)
expect_that(max(ebc$modularity), equals(modularity(g, ebc$membership)))
expect_that(membership(ebc), equals(c(1, 1, 2, 1, 3, 3, 3, 1, 4, 5,
3, 1, 1, 1, 4, 4, 3, 1, 4, 1,
4, 1, 4, 4, 2, 2, 4, 2, 2, 4,
4, 2, 4, 4)))
expect_that(length(ebc), equals(5))
expect_that(as.numeric(sizes(ebc)), equals(c(10, 6, 5, 12, 1)))
d <- as.dendrogram(ebc)
expect_that(print(d), prints_text("2 branches.*34 members.*height 33"))
expect_that(print(d[[1]]),
prints_text("2 branches.*15 members.*height 31"))
expect_that(print(d[[2]]),
prints_text("2 branches.*19 members.*height 32"))
m2 <- cutat(ebc, no=3)
expect_that(modularity(g, m2),
equals(ebc$modularity[length(ebc$modularity)-2]))
})
|