DiagrammeR (version 1.0.0)

delete_loop_edges_ws: Delete all loop edges associated with a selection of nodes

Description

With a selection of nodes in a graph, remove any associated loop edges.

Usage

delete_loop_edges_ws(graph)

Arguments

graph

a graph object of class dgr_graph.

Value

a graph object of class dgr_graph.

Examples

Run this code
# NOT RUN {
# Create an undirected, full graph
# of 5 nodes with loops retained
graph <-
  create_graph(
    directed = FALSE) %>%
  add_full_graph(
    n = 5,
    keep_loops = TRUE)

# Select nodes `3` and `4`
# and remove the loop edges
# associated with those nodes
graph <-
  graph %>%
  select_nodes_by_id(
    nodes = 3:4) %>%
  delete_loop_edges_ws()

# Count the number of loop
# edges remaining in the graph
graph %>%
  count_loop_edges()
# }

Run the code above in your browser using DataCamp Workspace