find_cycle | R Documentation |
This function returns a cycle of the graph, in terms of both its vertices and edges. If the graph is acyclic, it returns empty vertex and edge sequences.
Use is_acyclic()
to determine if a graph has cycles, without returning
a specific cycle.
find_cycle(graph, mode = c("out", "in", "all", "total"))
graph |
The input graph. |
mode |
Character constant specifying how to handle directed graphs.
|
A list of integer vectors, each integer vector is a path from the source vertex to one of the target vertices. A path is given by its vertex ids.
Graph cycles
feedback_arc_set()
,
feedback_vertex_set()
,
girth()
,
has_eulerian_path()
,
is_acyclic()
,
is_dag()
,
simple_cycles()
g <- make_lattice(c(3, 3))
find_cycle(g)
# Empty results are returned for acyclic graphs
find_cycle(sample_tree(5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.