Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

isAcyclic

Test for Cycles


Description

Returns TRUE if the given graph does not contain a directed cycle.

Usage

isAcyclic(x)

Arguments

x

the input graph, of any graph type.

Details

This function will only consider simple directed edges in the given graph.

Examples

g1 <- dagitty("dag{X -> Y -> Z}")
stopifnot( isTRUE(isAcyclic( g1 )) )
g2 <- dagitty("dag{X -> Y -> Z -> X}")
stopifnot( isTRUE(!isAcyclic( g2 )) )
g3 <- dagitty("mag{X -- Y -- Z -- X}")
stopifnot( isTRUE(isAcyclic( g3 )) )

dagitty

Graphical Analysis of Structural Causal Models

v0.3-1
GPL-2
Authors
Johannes Textor, Benito van der Zander, Ankur Ankan
Initial release
2021-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.