# NOT RUN {
# Create a directed graph containing
# only a balanced tree
graph_tree <-
create_graph() %>%
add_balanced_tree(
k = 2, h = 3)
# Determine whether this graph
# is a DAG
is_graph_dag(graph_tree)
#> [1] TRUE
# Create a directed graph containing
# a single cycle
graph_cycle <-
create_graph() %>%
add_cycle(n = 5)
# Determine whether this graph
# is a DAG
is_graph_dag(graph_cycle)
#> [1] FALSE
# Create an undirected graph
# containing a balanced tree
graph_tree_undirected <-
create_graph(
directed = FALSE) %>%
add_balanced_tree(
k = 2, h = 2)
# Determine whether this graph
# is a DAG
is_graph_dag(graph_tree_undirected)
#> [1] FALSE
# }
Run the code above in your browser using DataLab