isAcyclic: Graph queries

Description Usage Arguments Value Author(s) References Examples

Description

Checks if a given graph is acyclic.

Usage

1
isAcyclic(amat, method = 2)

Arguments

amat

a square Boolean matrix with dimnames, the adjacency matrix of a graph.

method

an integer 1 or 2 specifying the method used. If method=1 the function calls the function clusters in package igraph to find the strong components: two nodes v and w are in the same strong component iff there are directed paths from v to w and from w to v. If method=2 the function uses the ggm function transClos. Method 1 is faster.

Value

a logical value, TRUE if the graph is acyclic and FALSE otherwise.

Author(s)

David Edwards, Giovanni M. Marchetti

References

Aho, A.V., Hopcroft, J.E. \& Ullman, J.D. (1983). Data structures and algorithms. Reading: Addison-Wesley.

Examples

1
2
3
4
5
6
7
## 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)

ggm documentation built on March 26, 2020, 7:49 p.m.

Related to isAcyclic in ggm...