This file is indexed.

/usr/lib/R/site-library/igraph/tests/test_neighborhood.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
34
35
36
37
38
39
40
41
context("neighborhood")

test_that("neighborhood works", {

  library(igraph)

  neig <- function(graph, order, vertices) {
    sp <- shortest.paths(graph)
    v <- unique(unlist(lapply(vertices, function(x) {
      w <- which(sp[x,] <= order)
    })))
    induced.subgraph(graph, c(v,vertices))
  }

  g <- erdos.renyi.game(50, 5/50)

  v <- sample(vcount(g), 1)
  g1 <- graph.neighborhood(g, 2, v)[[1]]
  g2 <- neig(g, 2, v)
  expect_that(graph.isomorphic(g1, g2), is_true())

#########

  nei <- function(graph, order, vertices) {
    sp <- shortest.paths(graph)
    v <- unique(unlist(lapply(vertices, function(x) {
      w <- which(sp[x,] <= order)
    })))
    v
  }

  v1 <- neighborhood(g, 2, v)[[1]]
  v2 <- nei(g, 2, v)
  expect_that(sort(v1), equals(sort(v2))) 

#########

  s <- neighborhood.size(g, 2, v)[[1]]
  expect_that(s, equals(length(v1)))

})