tests/testthat/test-graph_attributes.R

context("graph_attributes")

test_that("attributes are applied correctly", {
  gr1 <- create_notable('bull')
  gr2 <- create_notable('diamond')
  igraph::graph_attr(gr1, 'igraph_attr') <- 'test'
  attr(gr1, 'standard_attr') <- 'test2'
  gr1 <- as_tbl_graph(gr1)
  gr2 <- gr2 %gr_attr% gr1
  expect_equal(attributes(gr1), attributes(gr2))
  expect_equal(graph_attr(gr1), graph_attr(gr2))
})

Try the tidygraph package in your browser

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

tidygraph documentation built on Feb. 16, 2023, 10:40 p.m.