Learn R Programming

DiagrammeR (version 0.7)

delete_edge: Delete an edge from an existing graph object

Description

From a graph object of class dgr_graph, delete an existing edge by specifying a pair of node IDs corresponding to the edge direction.

Usage

delete_edge(graph, from, to)

Arguments

graph
a graph object of class dgr_graph that is created using create_graph.
from
a node ID from which the edge to be removed is outgoing.
to
a node ID to which the edge to be removed is incoming.

Value

  • a graph object of class dgr_graph.

Examples

Run this code
# Create an empty graph
graph <- create_graph()

# Add two nodes
graph <- add_node(graph, node = "a")
graph <- add_node(graph, node = "b")

# Add an edge
graph <- add_edges(graph, from = "a", to = "b")

# Delete the edge
graph <- delete_edge(graph, from = "a", to = "b")

Run the code above in your browser using DataLab