tests/testthat/test-graph.adjlist.R

test_that("graph_from_adj_list works", {
  g <- sample_gnp(100, 3 / 100)
  al <- as_adj_list(g)
  g2 <- graph_from_adj_list(al, mode = "all")
  expect_true(graph.isomorphic(g, g2))

  ##

  g <- sample_gnp(100, 3 / 100, directed = TRUE)
  al <- as_adj_list(g, mode = "out")
  g2 <- graph_from_adj_list(al, mode = "out")
  expect_true(graph.isomorphic(g, g2))
})

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.