adj <- matrix(c(0, .5, .8, 0, .5, 0, .3, .6,
.8, .3, 0, .4, 0, .6, .4, 0), 4, 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")
# Keep only strong edges
filter_edges(adj, weight > 0.5)
# Matrix in, matrix out
filter_edges(adj, weight > 0.5, keep_format = TRUE)
# Pipe-friendly with cograph_network
as_cograph(adj) |>
filter_edges(weight > 0.3) |>
filter_nodes(degree >= 2) |>
splot()
Run the code above in your browser using DataLab