igraph (version 0.7.0)

is.dag: Directed acyclic graphs

Description

This function tests whether the given graph is a DAG, a directed acyclic graph.

Usage

is.dag(graph)

Arguments

graph
The input graph. It may be undirected, in which case FALSE is reported.

Value

  • A logical vector of length one.

concept

DAG

Details

is.dag checks whether there is a directed cycle in the graph. If not, the graph is a DAG.

Examples

Run this code
g <- graph.tree(10)
is.dag(g)
g2 <- g + edge(5,1)
is.dag(g2)

Run the code above in your browser using DataCamp Workspace