set_edges: Set Edges in Cograph Network

View source: R/class-network.R

set_edgesR Documentation

Set Edges in Cograph Network

Description

Replaces the edges in a cograph_network object. Expects a data frame with from, to, and optionally weight columns.

Usage

set_edges(x, edges_df)

Arguments

x

A cograph_network object.

edges_df

A data frame with columns: from, to, and optionally weight.

Value

The modified cograph_network object.

See Also

as_cograph, get_edges, set_nodes

Examples

mat <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), nrow = 3)
net <- as_cograph(mat)
new_edges <- data.frame(from = c(1, 2), to = c(2, 3), weight = c(0.5, 0.8))
net <- set_edges(net, new_edges)
get_edges(net)

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