simple_cycles | R Documentation |
This function lists all simple cycles in a graph within a range of cycle lengths. A cycle is called simple if it has no repeated vertices.
Multi-edges and self-loops are taken into account. Note that typical graphs have exponentially many cycles and the presence of multi-edges exacerbates this combinatorial explosion.
simple_cycles(
graph,
mode = c("out", "in", "all", "total"),
min = NULL,
max = NULL
)
graph |
The input graph. |
mode |
Character constant specifying how to handle directed graphs.
|
min |
Lower limit on cycle lengths to consider. |
max |
Upper limit on cycle lengths to consider. |
A named list, with two entries:
vertices |
The list of cycles in terms of their vertices. |
edges |
The list of cycles in terms of their edges. |
Graph cycles
feedback_arc_set()
,
feedback_vertex_set()
,
find_cycle()
,
girth()
,
has_eulerian_path()
,
is_acyclic()
,
is_dag()
g <- graph_from_literal(A -+ B -+ C -+ A -+ D -+ E +- F -+ A, E -+ E, A -+ F, simplify = FALSE)
simple_cycles(g)
simple_cycles(g, mode = "all") # ignore edge directions
simple_cycles(g, mode = "all", min = 2, max = 3) # limit cycle lengths
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.