reduce_network: Reduce a scored network

View source: R/network-combine.R

reduce_networkR Documentation

Reduce a scored network

Description

Retain edges from a scored network using either a minimum score or a top-edge rule. Source edge weights and identifier metadata are preserved, and the returned object's manifest() records the filter and source provenance.

Usage

reduce_network(
  net,
  select = list(min_score = NULL, n_top = NULL, random = FALSE),
  greedy = TRUE,
  output_network_format = c("same", "igraph", "sparse", "legacy"),
  case_sensitive = NULL
)

Arguments

net

A supported weighted network object.

select

Named selection list with min_score, n_top, and random. Specify either min_score, or n_top. With n_top, set random = TRUE to sample that many unique edges instead of ranking them by score.

greedy

Boundary-tie policy used with n_top. The default, TRUE, includes all edges tied at the boundary and can exceed n_top. FALSE excludes the whole boundary tie and can return fewer edges. NULL returns exactly n_top edges, resolving a boundary tie by alphanumeric canonical-endpoint order. Strict greedy = NULL selection is useful for size-matched network benchmarks.

output_network_format

Output representation. "same" preserves the input representation.

case_sensitive

Identifier case policy. By default, reuse the recorded policy of net, or use case-insensitive matching for an unmarked object.

Value

A reduced network with a transformation provenance manifest.

See Also

merge_networks(), load_network_database(), manifest()

Examples

edges <- data.frame(from = c("A", "A", "B", "C"),
  to = c("B", "C", "C", "D"), score = c(5, 4, 4, 2))
network <- import_network(edges, score_column = "score", species = NULL,
  input_id_format = "custom", verbose = FALSE)
reduce_network(network, select = list(n_top = 2))

NEArender documentation built on Nov. 28, 2026, 5:10 p.m.