File: test_layout.merge.R

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (27 lines) | stat: -rw-r--r-- 500 bytes parent folder | download | duplicates (4)
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

context("merge_coords")

test_that("merge_coords works", {

  library(igraph)
  set.seed(42)

  g <- list(make_ring(10), make_ring(5))
  l <- lapply(g, layout_with_mds)
  l

  lm <- merge_coords(g, l)
  expect_that(is.matrix(lm), is_true())
  expect_that(ncol(lm), equals(2))
  expect_that(nrow(lm), equals(sum(sapply(g, vcount))))

##########

  ## Stress test
  for (i in 1:10) {
    g <- sample_gnp(100, 2/100)
    l <- layout_with_mds(g)
    expect_that(dim(l), equals(c(vcount(g), 2)))
  }

})