cache_node_count_ws {DiagrammeR} | R Documentation |
From a graph object of class
dgr_graph
, get a count of nodes available in
a selection and cache that value in the graph for
later retrieval using get_cache
.
Selections of nodes can be performed using
the following select_...
functions:
select_nodes()
,
select_last_node()
,
select_nodes_by_degree()
,
select_nodes_by_id()
, or
select_nodes_in_neighborhood()
.
Selections of nodes can also be performed using
the following traversal functions:
(trav_...
):
trav_out()
, trav_in()
,
trav_both()
, trav_in_node()
,
trav_out_node()
.
cache_node_count_ws(graph)
graph |
a graph object of class
|
a graph object of class dgr_graph
.
# Create a graph with 5 nodes and 4 edges graph <- create_graph() %>% add_path(5) # Cache a count of nodes after creating a selection graph <- graph %>% select_nodes_by_id(2:5) %>% cache_node_count_ws() # Get the number of nodes stored in the cache graph %>% get_cache() #> [1] 4