From a graph object of class
dgr_graph, get a count of edges available in
a selection and cache that value in the graph for
later retrieval using get_cache.
Selections of edges can be performed using
the following select_... functions:
select_edges(),
select_last_edge(), or
select_edges_by_node_id().
Selections of edges can also be performed using
the following traversal functions:
trav_out_edge(), trav_in_edge(),
or trav_both_edge().
cache_edge_count_ws(graph, name = NULL)
| graph | a graph object of class
|
|---|---|
| name | an optional name for the cached vector. |
a graph object of class dgr_graph.
# NOT RUN { # Create a graph with 5 nodes and 4 edges graph <- create_graph() %>% add_path(n = 5) # Cache a count of edges after creating a selection graph <- graph %>% select_edges_by_node_id(nodes = 2) %>% cache_edge_count_ws(name = "edge_count") # Get the number of edges stored in the cache graph %>% get_cache(name = "edge_count") #> [1] 2 # }