Dependency Graph Topological Sorter with Cycle Detection
Dependency Graph Topological Sorter with Cycle Detection: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). You must write a command-line tool that reads a directed acyclic graph (DAG) specification from stdin or a file, performs a topological sort, and outputs the…
The task
You must write a command-line tool that reads a directed acyclic graph (DAG) specification from stdin or a file, performs a topological sort, and outputs the sorted nodes. If the graph contains cycles, the tool must detect them and output the nodes involved in a cycle instead.
Part of ai-and/termgrade-environments.