File: test-layout_large_graphs.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 (25 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download
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
test_that("layout_with_pmds works", {
    g <- igraph::make_graph(~ a - -b - -c - -d:e:f)
    expect_is(layout_with_pmds(g, 5), "matrix")
    expect_equal(ncol(layout_with_pmds(g, 5, dim = 3)), 3)
    expect_error(layout_with_pmds(g))
    expect_error(layout_with_pmds(g, 10))
    expect_error(layout_with_pmds(1))
    expect_no_error(layout_with_pmds(g, pivots = 5, weights = rep(4, 5)))

    g <- igraph::make_full_graph(10) + igraph::make_full_graph(10)
    expect_error(layout_with_pmds(g, 10))
})

test_that("layout_with_sparse_stress works", {
    g <- igraph::make_graph(~ a - -b - -c - -d:e:f)
    expect_is(layout_with_sparse_stress(g, 5), "matrix")
    expect_error(layout_with_sparse_stress(g))
    expect_error(layout_with_sparse_stress(g, 10))
    expect_error(layout_with_sparse_stress(1))

    g <- igraph::make_full_graph(10) + igraph::make_full_graph(10)
    expect_error(layout_with_sparse_stress(g, 10))
    g <- igraph::make_full_graph(10)
    expect_warning(layout_with_sparse_stress(g, pivots = 5, weights = rep(4, 45)))
})