delete_loop_edges_ws {DiagrammeR} | R Documentation

## 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

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

[Package DiagrammeR version 1.0.1 Index]