Calculating a critical path and its cost.