# Create a graph with nodes and no edges
nodes <-
create_nodes(
nodes = c("a", "b", "c", "d"),
type = "letter",
color = c("red", "green", "grey", "blue"),
value = c(3.5, 2.6, 9.4, 2.7))
graph <- create_graph(nodes_df = nodes)
# Create an edge data frame
edges <-
create_edges(
from = c("a", "b", "c"),
to = c("d", "c", "a"),
rel = "leading_to")
# Add the edge data frame to the graph object to create a
# graph with both nodes and edges
graph <-
add_edge_df(
graph = graph,
edge_df = edges)
get_edges(graph, return_type = "vector")
#> [1] "a -> d" "b -> c" "c -> a"
Run the code above in your browser using DataLab