Sub topic 12
Dependencies and the critical path
This chapter assumes you can already estimate individual tasks, in effort and in duration, and that you know basic project vocabulary such as task, milestone and schedule. Here you will connect those task estimates into a project schedule. The connection depends on which tasks must wait for others.
Why task estimates do not add up to a schedule
Summing task durations gives total effort. It does not give the project's end date. Tasks that can run at the same time overlap, and tasks that must run in sequence stack up. The project's duration is set by the longest chain of tasks that must happen one after another.
That longest chain is the critical path. Any delay to a task on it delays the whole project, day for day. Tasks off the critical path have float (also called slack), which is the time they can slip without moving the end date.
Types of dependencies
A dependency is a rule that one task's start or finish constrains another's. There are four logical types.
| Type | Meaning | Example |
|---|---|---|
| Finish-to-start (FS) | B cannot start until A finishes | Tests cannot start until the API is built |
| Start-to-start (SS) | B cannot start until A has started | Documentation starts once development starts |
| Finish-to-finish (FF) | B cannot finish until A finishes | Testing ends only after the final code change |
| Start-to-finish (SF) | B cannot finish until A starts | Rare. The old system is switched off only once the new one starts |
Finish-to-start covers most real work. Start with it, and use the others only when they describe the work more accurately.
Dependencies also differ by cause:
- Mandatory (hard) dependencies come from the nature of the work. You cannot test code that does not exist.
- Discretionary (soft) dependencies come from preference or convention. The team simply likes to finish design before coding. These can be changed.
- External dependencies involve something outside the team, such as a vendor delivery or an approval. They are the most common source of surprise because you do not control them.
A lag adds a required delay between linked tasks, for example three days of concrete curing. A lead lets the successor start before the predecessor finishes, for example starting UI work when the API is 50% done.
Finding the critical path
The method has two passes over a network of tasks.
- Forward pass. For each task, the earliest start (ES) is the largest earliest finish (EF) among its predecessors. Then EF = ES + duration.
- Backward pass. Starting from the project end, the latest finish (LF) of each task is the smallest latest start (LS) among its successors. Then LS = LF − duration.
- Float = LS − ES. Tasks with zero float form the critical path.
The following diagram shows a small network. Task durations are in days.
The paths from Design to Release are:
- Design → API → Tests → Release: 3 + 5 + 4 + 1 = 13 days
- Design → UI → Tests → Release: 3 + 8 + 4 + 1 = 16 days
- Design → Docs → Release: 3 + 2 + 1 = 6 days
The UI path is the longest, so the critical path is 16 days. API has 3 days of float, and Docs has 10.
Computing it in code
The script below runs the forward and backward passes on the network above and reports float.
from graphlib import TopologicalSorter
durations = {
"design": 3, "api": 5, "ui": 8, "docs": 2, "tests": 4, "release": 1,
}
# task -> set of predecessors (finish-to-start)
preds = {
"design": set(),
"api": {"design"},
"ui": {"design"},
"docs": {"design"},
"tests": {"api", "ui"},
"release": {"tests", "docs"},
}
order = list(TopologicalSorter(preds).static_order())
# Forward pass
es, ef = {}, {}
for t in order:
es[t] = max((ef[p] for p in preds[t]), default=0)
ef[t] = es[t] + durations[t]
project_end = max(ef.values())
# Backward pass
succs = {t: set() for t in durations}
for t, ps in preds.items():
for p in ps:
succs[p].add(t)
ls, lf = {}, {}
for t in reversed(order):
lf[t] = min((ls[s] for s in succs[t]), default=project_end)
ls[t] = lf[t] - durations[t]
print(f"project duration: {project_end} days")
for t in order:
flt = ls[t] - es[t]
mark = " <- critical" if flt == 0 else ""
print(f"{t:8} ES={es[t]:2} EF={ef[t]:2} float={flt}{mark}")Running it prints a duration of 16 days. Design, UI, tests and release show zero float. API shows 3 and docs shows 10.
How the critical path changes
The critical path is not fixed. It shifts as estimates change or as work progresses.
- If UI turns out to take 5 days instead of 8, both API and UI paths become 13 days. Now both are critical, and the project has two chains that must go well.
- If UI drops to 4 days, the API path (13 days) becomes the longest and API becomes critical.
- Shortening a critical task helps only until another path becomes equally long. The gain is limited by the float on the nearest competing path.
Tasks with small float are near-critical. A schedule with many near-critical paths is riskier than one dominated by a single long path, because any of several tasks can slip and delay the end.
Connecting this to effort and uncertainty
Earlier chapters converted effort into duration using people and focus. That produces the duration values used here. Two interactions matter.
First, resource dependencies are dependencies too. If one engineer is assigned both API and UI, those tasks cannot run in parallel even though the logic allows it. The network above would then have a 3 + 5 + 8 + 4 + 1 = 21 day path. Check the network again after assigning people. This step is called resource leveling.
Second, merge points amplify risk. Integration Tests waits for both API and UI. Even if each has a 50% chance of finishing on time, the chance that both do is only about 25%, assuming they are independent. The more paths merge into a task, the more likely the task starts late. This is why simply summing expected values on the critical path tends to give optimistic dates.
For this reason, use the three-point estimates from the earlier chapter on each task. Then check how close the competing paths are. If the critical path is 16 days and a second path is 15 days with high variance, the second path may be the real driver of the date. A simulation that samples each task's range many times shows how often each path ends up critical.
Reducing project duration
Once you know the critical path, you have two standard ways to shorten it.
- Fast-tracking runs tasks in parallel that were planned in sequence, often by turning finish-to-start into a lead. It adds rework risk, since the later task starts on incomplete input.
- Crashing adds resources to critical tasks. It costs money and has limits. Adding people to a task adds coordination work, and some tasks cannot be split. Crash the tasks where each extra day of reduction is cheapest, and stop when another path becomes critical.
Both options apply only to the critical path. Speeding up a task with float does not move the end date.
Common errors
- Missing dependencies. An unlisted dependency makes tasks look parallel when they are not, which shortens the apparent schedule. Ask of every task, "What do I need before I can start, and who provides it?"
- Unnecessary dependencies. Linking tasks out of habit lengthens the critical path. Question each soft dependency.
- Ignoring external dates. Vendor deliveries, approvals and reviews belong in the network with their own durations and owners.
- Treating float as free time. Float is shared along a path. If two sequential tasks each use the full float of the path, the second one has none left.
- Never recalculating. Update the network whenever estimates, actuals or assignments change.
Exercise
A project has three paths from start to finish. Path A: 4 + 6 + 3 = 13 days. Path B: 4 + 9 + 2 = 15 days. Path C: 5 + 8 + 2 = 15 days. What is the project duration, which paths are critical, and what happens if you shorten the 9-day task on path B by 3 days?
Show answer
The project duration is 15 days, set by the longest paths. Paths B and C are both critical, and path A has 2 days of float. Shortening the 9-day task by 3 days makes path B 12 days, but path C still takes 15 days, so the project duration does not change. Path C is now the only critical path, and path B gains 3 days of float.
Exercise
Two tasks, X and Y, run in parallel and feed into task Z. Each has a 70% chance of finishing on its planned date, and they are independent. What is the chance that Z can start on schedule, and why does this matter for the plan?
Show answer
The chance is 0.7 × 0.7 = 0.49, about 49%. Merge points make late starts more likely than any single task's odds suggest. The plan should add a buffer before the merge point, and the estimate for Z's start should be stated as a range instead of a single date.