# Create a node
node <- g6_node(
id = "n1",
type = "rect",
data = list(label = "Node 1"),
style = list(color = "red"),
states = list("selected"),
combo = NULL,
children = c("n2", "n3")
)
# Create an edge
edge <- g6_edge(
source = "n1",
target = "n2",
type = "line",
style = list(width = 2)
)
# Create a combo
combo <- g6_combo(
id = "combo1",
type = "rect",
data = list(label = "Combo 1"),
style = list(border = "dashed"),
states = list("active"),
combo = NULL
)
# Validate a node explicitly
validate_element(node)
Run the code above in your browser using DataLab