Back to the Lab Index

Lab 10 - Generating Valid Course Schedules
Due: Monday, April 24, 2006 at 11:59PM

Zipped collection of support files .

Solution

The Assignment

This assignment asks you to generate a valid course schedule, given a collection of courses and prerequisites.

The idea is to build a graph using an adjacency list that represents the courses and dependencies, and then to perform a topological sort on this graph, yielding a valid schedule. If a valid schedule can't be generated, because there are one or more cycles in the prerequisite chains (that absolutely never occurs in the real world), it should identify the dependences that cannot be satisfied.

We have given you a nearly complete, but not entirely complete AdjList class. You will need to review the source files and complete methods indicated by comments within the files.

We have also given you most of the CoursePlanner class. The CoursePlanner class will read the data files and create the graph using the AdjList's constructor. It will also maintain a mapping from each course name, to the vertex number used by the AdjList. This file will also print out the prerequisite information, call the topologicalSort() method, and print out the schedule, or the list of unsatisfied dependencies.

So, in the end, you really only need to do one thing: finish the implementation of the AdjList class, as indicated by the comments within the source file, including the complete implementation of the topologicalSort()