Learn R Programming

cograph (version 1.5.2)

set_edges: 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. Updates the from, to, weight vectors and n_edges.

Usage

set_edges(x, edges_df)

Value

The modified cograph_network object.

Arguments

x

A cograph_network object.

edges_df

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

See Also

as_cograph, get_edges, set_nodes

Examples

Run this code
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)

Run the code above in your browser using DataLab