isAcyclic | R Documentation |
Checks if a given graph is acyclic.
isAcyclic(amat, method = 2)
amat |
a square Boolean matrix with dimnames, the adjacency matrix of a graph. |
method |
an integer 1 or 2 specifying the method used. If |
a logical value, TRUE
if the graph is acyclic and FALSE
otherwise.
David Edwards, Giovanni M. Marchetti
Aho, A.V., Hopcroft, J.E. & Ullman, J.D. (1983). Data structures and algorithms. Reading: Addison-Wesley.
## A cyclic graph
d <- matrix(0,3,3)
rownames(d) <- colnames(d) <- c("x", "y", "z")
d["x","y"] <- d["y", "z"] <- d["z", "x"] <- 1
## Test if the graph is acyclic
isAcyclic(d)
isAcyclic(d, method = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.