/usr/lib/R/site-library/igraph/tests/test_graphNEL.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 27 28 29 30 31 32 33 | context("graphNEL conversion")
test_that("graphNEL conversion works", {
library(igraph)
library(graph, warn.conflicts=FALSE)
g <- erdos.renyi.game(100, 5/100)
N <- igraph.to.graphNEL(g)
g2 <- igraph.from.graphNEL(N)
gi <- graph.isomorphic.vf2(g, g2)
expect_that(gi$iso, is_true())
expect_that(gi$map12, equals(1:vcount(g)))
expect_that(gi$map21, equals(1:vcount(g)))
## Attributes
V(g)$name <- as.character(vcount(g):1)
E(g)$weight <- sample(1:10, ecount(g), replace=TRUE)
g$name <- "Foobar"
N <- igraph.to.graphNEL(g)
g2 <- igraph.from.graphNEL(N)
expect_that(graph.isomorphic(g, g2), is_true())
expect_that(V(g)$name, equals(V(g2)$name))
A <- get.adjacency(g, attr="weight", sparse=FALSE)
A2 <- get.adjacency(g2, attr="weight", sparse=FALSE)
expect_that(A, equals(A))
expect_that(g$name, equals(g2$name))
suppressWarnings(unloadNamespace("graph"))
})
|