C++ clean topo sort solution

The key point is to give 3 states to each course.
0 means a course isn't visited yet.
1 means a course is VISITED but it still waits for its prerequisites to finish, i.e, it's not finished.
2 means a course is finished.
So in each recursion, we first mark a course as 1, and try to finish all its prerequisites. If one of its prerequisites also has state 1, it means there's a cycle and we should stop going deeper by returning false. If all its prerequisites are finished, then we can finish the current course and mark it as 2 and put it into the order list. By doing these to each graph, we can get a valid course order.