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

is.acyclic

Check if a DAG actually is acyclic.


Description

This function checks for each node in a DAG whether backtracing arcs leading to it results in an "infinite recursion" error indicating that there actually is a cyclic part in the DAG (which then obviously seems not to be a DAG).

Usage

is.acyclic(dag, maxSecs=NA)

Arguments

dag

The DAG to be check.

maxSecs

maximum time before function aborts;

Value

A list with two elements. acyclic is a boolean indicating whether the DAG is acyclic (=TRUE) or contains a cyclic component (=FALSE). nodewise is a vector containing 1 boolean per node in the DAG, TRUE indicating that backtracing from this node does not lead to a cyclic component, FALSE indicating that backtracing from this node leads to a cyclic component.

Author(s)

Lutz P Breitling <l.breitling@posteo.de>

Examples

dag6<-demo.dag6();
is.acyclic(dag6);
dag6c<-add.arc(dag6, c(3,5));
is.acyclic(dag6c);

dagR

R Functions for Directed Acyclic Graphs

v1.2.0
GPL-2
Authors
Lutz P Breitling
Initial release
2021-04-17

We don't support your browser anymore

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