/usr/lib/R/site-library/igraph/tests/test_graph.bipartite.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 | context("graph.bipartite")
test_that("graph.bipartite works", {
library(igraph)
I <- matrix(sample(0:1, 35, replace=TRUE, prob=c(3,1)), nc=5)
g <- graph.incidence(I)
edges <- unlist(sapply(seq_len(nrow(I)), function(x) {
w <- which(I[x,] != 0) + nrow(I)
if (length(w)!=0) { as.vector(rbind(x, w)) } else { numeric() }
}))
g2 <- graph.bipartite(seq_len(nrow(I)+ncol(I)) > nrow(I), edges)
I2 <- get.incidence(g2)
expect_that(I2, is_equivalent_to(I))
})
|