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. Use find_cycle() to return a specific cycle.

See also

is_acyclic().

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