Model the courses and their prerequisites as a directed graph.