Learn R Programming

DiagrammeR (version 0.7)

is_graph_directed: Is the graph a directed graph?

Description

Determines whether a graph is set to be directed or not and returns a logical value to that effect.

Usage

is_graph_directed(graph)

Arguments

graph
a graph object of class dgr_graph.

Value

  • a logical value.

Examples

Run this code
# Create a graph with nodes and edges
nodes <-
  create_nodes(nodes = c("a", "b", "c", "d"))

edges <-
  create_edges(from = c("a", "b", "c"),
               to = c("d", "c", "a"))

graph <-
  create_graph(nodes_df = nodes,
               edges_df = edges)

# Determine whether the graph is directed
is_graph_directed(graph)
#> [1] TRUE

Run the code above in your browser using DataLab