Description Usage Arguments Details Value Author(s) Examples
Test whether an undirected graph, represented by an adjacency matrix, is acyclic.
1 | is_acyclic(adj_matrix)
|
adj_matrix |
The adjacency matrix representing the graph. |
Notice that the function cannot cope with loops. If the graph has loops, an error is returned.
A logical value indicating whether the graph is acyclic.
Katrine Kirkeby, enir_tak@hotmail.com
Maria Knudsen, mariaknudsen@hotmail.dk
Ninna Vihrs, ninnavihrs@hotmail.dk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | adj_matrix_cyclic <- matrix(c(0, 1, 1, 1,
1, 0, 0, 1,
1, 0, 0, 0,
1, 1, 0, 0),
nrow = 4)
is_acyclic(adj_matrix_cyclic)
adj_matrix_acyclic <- matrix(c(0, 0, 1, 1,
0, 0, 0, 1,
1, 0, 0, 0,
1, 1, 0, 0),
nrow = 4)
is_acyclic(adj_matrix_acyclic)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.