File: test-layout_spectral.R

package info (click to toggle)
r-cran-graphlayouts 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,660 kB
  • sloc: cpp: 696; sh: 13; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 721 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
library(igraph)
test_that("layout_spectral works", {
  g <- igraph::make_graph( ~ a -- b -- c -- d:e:f)

  expect_is(layout_with_eigen(g,type = "adjacency",ev = "largest"),"matrix")
  expect_is(layout_with_eigen(g,type = "adjacency",ev = "smallest"),"matrix")
  expect_is(layout_with_eigen(g,type = "laplacian",ev = "largest"),"matrix")
  expect_is(layout_with_eigen(g,type = "laplacian",ev = "smallest"),"matrix")

  expect_warning(layout_with_eigen(igraph::as.directed(g)))
  expect_error(layout_with_eigen(igraph::graph.empty(10,directed = FALSE)))

  expect_error(layout_with_eigen(g, type = "laplacian", ev = "middlest"))
  expect_error(layout_with_eigen(g, type = "random"))
  expect_error(layout_with_eigen(1))
})