Extracted from here we got a minimal iterative dfs routine, i call it minimal because you can hardly simplify the code further: Here’s my question, how could you transform this routine into a topological sort method where the routine also becomes “minimal”? I’ve watched this video and the idea is quite clever so I was wondering if it’d be possible