class

Craph::DAG(T)

Inherits Craph::Graph / Reference / Object

Directed Acyclic Graph, extends Graph with cycle detection and topological sorting.

Constructors

Instance methods

acyclic?

Check if the graph has no cycles using DFS

Source
topological_sort(strict : Bool = true) : Array(Set(T))

Return the nodes sorted topologically. The algorithm uses clustered output to allow for parallel processing. When strict (default), raises CycleError if cycles exist. When not strict, cyclic nodes are excluded from the result.

Source