is_dag() checks if a graph has a topological ordering (i.e. is a directed acyclic graph) using Kahn's algorithm.

is_dag(x)

Arguments

x

An adjacency matrix to be tested.

Value

A logical scalar.

References

Kahn, A. B. (1962). Topological sorting of large networks. Communications of the ACM, 5(11), p. 558-562. doi: 10.1145/368996.369025 .