to_network: Convert Network to statnet network Object

View source: R/network-utils.R

to_networkR Documentation

Convert Network to statnet network Object

Description

Converts any supported network format to a statnet network object.

Usage

to_network(x, directed = NULL)

Arguments

x

Network input: matrix, cograph_network, igraph, tna, etc.

directed

Logical or NULL. If NULL (default), auto-detect from input.

Value

A network object from the network package.

See Also

to_igraph, to_matrix, to_df, as_cograph

Examples

if (requireNamespace("network", quietly = TRUE)) {
  adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3)
  rownames(adj) <- colnames(adj) <- c("A", "B", "C")
  net <- to_network(adj)
}

cograph documentation built on April 1, 2026, 1:07 a.m.