Skip to contents

Checks if a directed graph is a Direct Acyclic Graph (DAG) and returns the topological order.

Usage

GetAndCheckTopologicalSort(arcSources, arcTargets, numNodes)

Arguments

arcSources

Vector corresponding to the source nodes of a graph's edges

arcTargets

Vector corresponding to the destination nodes of a graph's edges

numNodes

The number of nodes in the graph

Value

A named list containing 1) "is_DAG": a logical stating if the graph is a DAG, and 2) "indices": a vector of length numNodes, containing the index of vertex i in the ordering at location i