Write a Python script that reads a directed graph from a file and performs a topological sort. The script…
Write a Python script that reads a directed graph from a file and performs a topological sort. The script…: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). Input file format: - One edge per line, format: SOURCE - TARGET - Lines may be empty or contain only…
The task
**Input file format:** - One edge per line, format: `SOURCE -> TARGET` - Lines may be empty or contain only whitespace (ignore them) - Lines starting with `#` are comments (ignore them) - Node names are case-sensitive strings containing any printable ASCII characters except `-` and `>`, and cannot be empty - There…
Part of ai-and/termgrade-environments.