library(RGraphSpace)
library(igraph)
g <- make_star(6, mode = "out")
gs <- GraphSpace(g)
gs <- normalizeGraphSpace(gs)
# Functional form (pipe-friendly): returns a modified copy
gs <- gs_add_edges(gs, data.frame(from = "n2", to = "n3"))
# Assignment form: modifies gs in place
gs_add_edges(gs) <- data.frame(from = "n3", to = "n4")
# Add multiple edges with an analytical attribute
gs <- gs_add_edges(gs, data.frame(
from = c("n4", "n5"),
to = c("n5", "n6"),
weight = c(0.8, 0.4)
))
Run the code above in your browser using DataLab