Graph Theory37 sections · 1633 units
Open in Course

Parallel Courses III - Core Idea

Finish time propagates

This problem is the Critical Path Method, a technique used in project management to find the minimum time to complete a project with dependencies. You can take multiple courses in parallel, but each course can only start after all its prerequisites are finished.

The finish time of course ii is: finish[i] = time[i] + max(finish[j]) for all prerequisites jj of ii. If course ii has no prerequisites, finish[i] = time[i]. The answer is max(finish[i]) over all courses.

Why topological sort? We need to compute finish[j] before finish[i] for all prerequisites jj. Processing in topological order guarantees this. The longest path in the dependency graph is the critical path. It determines the minimum project duration.