complement_network: Complement of a Network

View source: R/wrangle-structure.R

complement_networkR Documentation

Complement of a Network

Description

Every pair of distinct nodes that is not joined in x is joined in the complement, and every joined pair is absent from it.

Usage

complement_network(
  x,
  weight = 1,
  loops = FALSE,
  keep_format = FALSE,
  directed = NULL
)

Arguments

x

Network input.

weight

Numeric. Weight of every edge in the complement. Default 1. A weight of zero means no edge, so weight = 0 raises a cograph_bad_selection error.

loops

Logical. Include self-loops in the complement. Default FALSE.

keep_format

Logical. If TRUE, a matrix, igraph, statnet network or tna input is returned in its own format. An edge-list data frame or a qgraph object is returned as a cograph_network with a cograph_no_format_roundtrip warning. Default FALSE returns a cograph_network.

directed

Logical or NULL. Directedness used to read the input. NULL (default) detects it from the input.

Value

A cograph_network holding the complement, or the input format when keep_format = TRUE. Directedness is preserved.

See Also

to_undirected, binarize

Examples

complement_network(threshold_edges(regulation_net, minimum = 0.2))

cograph documentation built on Nov. 19, 2026, 5:07 p.m.