Learn R Programming

DiagrammeR (version 1.0.9)

get_edge_df_ws: Get the graph's edf filtered by a selection of edges

Description

From a graph object of class dgr_graph, get the graph's internal edge data frame that is filtered by the edge ID values currently active as a selection.

Usage

get_edge_df_ws(graph)

Value

an edge data frame.

Arguments

graph

A graph object of class dgr_graph.

Details

This function makes use of an active selection of edges (and the function ending with _ws hints at this).

Selections of edges can be performed using the following selection (select_*()) functions: select_edges(), select_last_edges_created(), select_edges_by_edge_id(), or select_edges_by_node_id().

Selections of edges can also be performed using the following traversal (trav_*()) functions: trav_out_edge(), trav_in_edge(), trav_both_edge(), or trav_reverse_edge().

Examples

Run this code
# Create a random graph using the
# `add_gnm_graph()` function
graph <-
  create_graph() %>%
  add_gnm_graph(
    n = 4,
    m = 4,
    set_seed = 23) %>%
  set_edge_attrs(
    edge_attr = value,
    values = c(2.5, 8.2, 4.2, 2.4))

# Select edges with ID values
# `1` and `3`
graph <-
  graph %>%
  select_edges_by_edge_id(
    edges = c(1, 3))

# Get the edge data frame that's
# limited to the rows that correspond
# to the edge selection
graph %>% get_edge_df_ws()

Run the code above in your browser using DataLab