tests/testthat/test-largest.independent.vertex.sets.R

test_that("largest_ivs works", {
  g <- sample_gnp(50, 0.8)
  livs <- largest_ivs(g)
  expect_that(
    unique(sapply(livs, length)),
    equals(ivs_size(g))
  )

  ec <- sapply(seq_along(livs), function(x) {
    ecount(induced_subgraph(g, livs[[x]]))
  })
  expect_that(unique(ec), equals(0))

  ## TODO: check that they are largest
})

Try the igraph package in your browser

Any scripts or data that you put into this service are public.

igraph documentation built on Aug. 10, 2023, 9:08 a.m.