Very good explanation. Really helped me wrap my head around topological sorting with just this video, even though it's the first time I have heard of it.Thank you, make more!
I think your graph representation is confusing. Because for [1, 0] prereq, you drawed as 0 --> 1 like 0 is dependent to 1. But in this case 1 is dependent to 0 (we have to take course 0 before course 1, so course 1 depends on course 0)
Thanks a lot for the video. I tried a BFS with a set that keeps track of already visited nodes for cycle detection but that didn't seem to work, any ideas on as to why?
BFS with only a set will sometimes falsely detect a cycle in a directed graph. Imagine a graph: 0 -> 1, 1 -> 2, 0 -> 2. So there are two directed edges going into 2. If you start from 0, BFS will detect a cycle because you'll visit 2 twice, but because of the direction of the edges, there is actually no cycle.