## Not run:
# # Before getting edges, create a simple graph
# 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))
#
# edges <-
# create_edges(from = c("a", "b", "c"),
# to = c("d", "c", "a"),
# rel = "leading_to",
# color = c("pink", "blue", "red"),
# value = c(3.9, 2.5, 7.3))
#
# graph <-
# create_graph(nodes_df = nodes,
# edges_df = edges)
#
# # Get all edges within a graph, returned as a list
# get_edges(graph)
# #> [[1]]
# #> [1] "a" "b" "c"
# #>
# #> [[2]]
# #> [1] "d" "c" "a"
#
# # Get all edges within a graph, returned as a data frame
# get_edges(graph, return_type = "df")
# #> from to
# #> 1 a d
# #> 2 b c
# #> 3 c a
#
# # Get all edges within a graph, returned as a vector
# get_edges(graph, return_type = "vector")
# #> [1] "a -> d" "b -> c" "c -> a"
#
# # Get a vector of edges using a numeric
# # comparison (i.e., all edges with 'value' attribute
# # greater than 3)
# get_edges(graph,
# edge_attr = "value",
# match = "> 3",
# return_type = "vector")
# #> [1] "a -> d" "c -> a"
#
# # Get a vector of edges using a match
# get_edges(graph,
# edge_attr = "color",
# match = "pink",
# return_type = "vector")
# #> [1] "a -> d"
# ## End(Not run)
Run the code above in your browser using DataLab