add_edge {DiagrammeR} | R Documentation

## Add an edge between nodes in a graph object

### Description

With a graph object of class `dgr_graph`, add an edge to nodes within the graph.

### Usage

    add_edge(graph, from, to, rel = NULL)

### Arguments

`graph` | a graph object of class `dgr_graph` that is created using `create_graph`.
`from` | the outgoing node from which the edge is connected.
`to` | the incoming nodes to which each edge is connected.
`rel` | an optional string specifying the relationship between the connected nodes.

### Value

a graph object of class `dgr_graph`.

### Examples

    ## Not run:
    # Create a graph with two nodes
    graph <- create_graph(create_nodes(nodes = c("a", "b")))

    # Add an edge between those nodes and attach a relationship to the edge
    graph <- add_edge(graph, from = "a", to = "b", rel = "to_get")

    ## End(Not run)

[Package DiagrammeR version 0.8.2 Index]