DiagrammeR (version 1.0.0)

set_graph_directed: Convert an undirected graph to a directed graph

Description

Take a graph which is undirected and convert it to a directed graph.

Usage

set_graph_directed(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 a graph with a
# undirected tree
graph <-
  create_graph(
    directed = FALSE) %>%
  add_balanced_tree(
    k = 2, h = 2)

# Convert this graph from
# undirected to directed
graph <-
  graph %>%
  set_graph_directed()

# Perform a check on whether
# graph is directed
graph %>%
  is_graph_directed()
# }

Run the code above in your browser using DataCamp Workspace