DiagrammeR (version 0.9.0)

cache_edge_count_ws: Cache a count of edges (available in a selection) in the graph

Description

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().

Usage

cache_edge_count_ws(graph)

Arguments

graph

a graph object of class dgr_graph.

Value

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 edges after creating a selection graph <- graph select_edges_by_node_id(2) cache_edge_count_ws()

# Get the number of edges stored in the cache graph #> [1] 4