delete_edges_ws: Delete all selected edges in an edge selection

View source: R/delete_edges_ws.R

delete_edges_wsR Documentation

Delete all selected edges in an edge selection

Description

In a graph object of class dgr_graph, delete all edges present in a selection.

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

Usage

delete_edges_ws(graph)

Arguments

graph

A graph object of class dgr_graph.

Value

A graph object of class dgr_graph.

See Also

Other edge creation and removal: add_edge(), add_edge_clone(), add_edge_df(), add_edges_from_table(), add_edges_w_string(), add_forward_edges_ws(), add_reverse_edges_ws(), copy_edge_attrs(), create_edge_df(), delete_edge(), delete_loop_edges_ws(), drop_edge_attrs(), edge_data(), join_edge_attrs(), mutate_edge_attrs(), mutate_edge_attrs_ws(), recode_edge_attrs(), rename_edge_attrs(), rescale_edge_attrs(), rev_edge_dir(), rev_edge_dir_ws(), set_edge_attr_to_display(), set_edge_attrs(), set_edge_attrs_ws()

Examples

# Create a graph
graph <-
  create_graph() %>%
  add_n_nodes(n = 3) %>%
  add_edges_w_string(
    edges = "1->3 1->2 2->3")

# Select edges attached to
# node with ID `3` (these are
# `1`->`3` and `2`->`3`)
graph <-
  graph %>%
  select_edges_by_node_id(nodes = 3)

# Delete edges in selection
graph <-
  graph %>%
  delete_edges_ws()

# Get a count of edges in the graph
graph %>% count_edges()


DiagrammeR documentation built on June 22, 2024, 11:21 a.m.