This function tests whether the given graph is free of cycles.
Details
This function looks for directed cycles in directed graphs and undirected
cycles in undirected graphs. Use find_cycle()
to return a specific cycle.
See also
is_forest()
and is_dag()
for functions specific to undirected
and directed graphs.
Graph cycles
feedback_arc_set()
,
feedback_vertex_set()
,
find_cycle()
,
girth()
,
has_eulerian_path()
,
is_dag()
Other structural.properties:
bfs()
,
component_distribution()
,
connect()
,
constraint()
,
coreness()
,
degree()
,
dfs()
,
distance_table()
,
edge_density()
,
feedback_arc_set()
,
feedback_vertex_set()
,
girth()
,
is_dag()
,
is_matching()
,
k_shortest_paths()
,
knn()
,
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