tests/testthat/test-reciprocity.R

test_that("reciprocity works", {
  g <- make_graph(c(1,2, 2,1, 2,3, 3,4, 4,4), directed = TRUE)
  expect_equal(reciprocity(g), 0.5)
  expect_equal(reciprocity(g, ignore.loops = FALSE), 0.6)
})

Try the igraph package in your browser

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

igraph documentation built on Oct. 20, 2024, 1:06 a.m.