Skip to contents

This function tests whether the given graph is free of cycles.

Usage

is_acyclic(graph)

Arguments

graph

The input graph.

Value

A logical vector of length one.

Details

This function looks for directed cycles in directed graphs and undirected cycles in undirected graphs.

See also

is_forest() and is_dag() for functions specific to undirected and directed graphs.

Graph cycles feedback_arc_set(), girth(), has_eulerian_path(), is_dag()

Other structural.properties: bfs(), component_distribution(), connect(), constraint(), coreness(), degree(), dfs(), distance_table(), edge_density(), feedback_arc_set(), girth(), is_dag(), is_matching(), k_shortest_paths(), knn(), laplacian_matrix(), reciprocity(), subcomponent(), subgraph(), topo_sort(), transitivity(), unfold_tree(), which_multiple(), which_mutual()

Examples


g <- make_graph(c(1,2, 1,3, 2,4, 3,4), directed = TRUE)
is_acyclic(g)
#> [1] TRUE
is_acyclic(as.undirected(g))
#> [1] FALSE