tests/testthat/test-motif_brokerage.R

test_that("node_by_brokering_activity works", {
  test <- node_by_brokering_activity(ison_networkers, "Discipline")
  expect_s3_class(test, "node_measure")
  expect_equal(c(net_nodes(ison_networkers)), length(test))
  expect_equal(top3(test), c(333,207,3))
})

test_that("node_brokering_exclusivity works", {
  test <- node_by_brokering_exclusivity(ison_networkers, "Discipline")
  expect_s3_class(test, "node_measure")
  expect_equal(c(net_nodes(ison_networkers)), length(test))
  expect_equal(top3(test), c(1,0,0))
})

test_that("node_in_brokering works", {
  test <- node_in_brokering(ison_networkers, "Discipline")
  expect_s3_class(test, "node_member")
  expect_equal(c(net_nodes(ison_networkers)), length(test))
  expect_equal(top3(test), c("Powerhouse","Connectors","Sideliners"))
  expect_output(print(node_in_brokering(to_uniplex(fict_marvel, "affiliation"))), "4 groups")
  expect_output(print(summary(node_in_brokering(to_uniplex(fict_marvel, "affiliation")))), "Connectors")
})

Try the netrics package in your browser

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

netrics documentation built on July 24, 2026, 5:07 p.m.