Simple algorithm -
1) Find any vertex with no incomming edges. Put it on the
order list and remove it and its edges from the Graph.
2) Repeat step on until there are no more
vertices.
Result on our example:
CS1020, CS1160, CS2340, CS2360, CS3240
(is there another possible order??)
Example Pseudocode