Sub topic 2
Finding the critical path
This chapter assumes you know basic project management vocabulary (scope, schedule, cost, resources). It also assumes you can read a simple activity network or Gantt chart and do arithmetic on durations. Everything here uses finish-to-start dependencies. Other dependency types and leads come later in the course.
Why the critical path matters for compression
Schedule compression shortens a project without cutting scope. Before you can shorten anything, you need to know which activities control the finish date. Shortening an activity that does not control it costs money and gains nothing.
The critical path is the longest chain of dependent activities from the project start to the project finish. Its length is the shortest time the project can take with the current plan. Activities on it are critical activities. If one of them runs one day late, the project finishes one day late. If one of them finishes one day early, the project can finish up to one day early, provided no other path is equally long.
The word "longest" surprises many learners. The critical path is the longest path because the project cannot finish until every path has finished. The slowest path therefore sets the pace.
The example network
This chapter uses a four-activity network. It is the same network used in the crashing code later in the course.
| Activity | Duration (days) | Predecessors |
|---|---|---|
| A | 3 | none |
| B | 5 | A |
| C | 4 | A |
| D | 3 | B, C |
A predecessor is an activity that must finish before another can start. A and D are the start and end of the network. B and C can run in parallel once A is done, and D waits for both.
Method 1: add up every path
For a small network, list each path from start to finish and add the durations.
| Path | Calculation | Length |
|---|---|---|
| A, B, D | 3 + 5 + 3 | 11 days |
| A, C, D | 3 + 4 + 3 | 10 days |
The longest path is A, B, D at 11 days. That is the critical path, and the project duration is 11 days.
This method breaks down as networks grow. The number of paths can multiply quickly. Two parallel branches after every activity double the path count each time. Real schedules with hundreds of activities need a systematic method.
Method 2: forward and backward pass
The forward pass and backward pass find the critical path without listing paths. They compute four numbers for each activity.
- Early start (ES) is the earliest the activity can begin.
- Early finish (EF) is ES plus the duration.
- Late finish (LF) is the latest the activity can finish without delaying the project.
- Late start (LS) is LF minus the duration.
Forward pass
Work from the start of the network to the end.
- An activity with no predecessors has ES = 0.
- EF = ES + duration.
- For any other activity, ES is the largest EF among its predecessors.
The third rule is the one that matters. D has two predecessors, so D cannot start until both are done. B finishes at day 8 and C at day 7, so D starts at day 8. The project duration is the largest EF in the network, which is D's EF of 11.
Backward pass
Work from the end of the network to the start.
- An activity with no successors has LF equal to the project duration.
- LS = LF - duration.
- For any other activity, LF is the smallest LS among its successors.
A successor is an activity that depends on this one. Here the smallest value wins, because the activity must finish early enough for its most demanding successor.
Result
| Activity | ES | EF | LS | LF | Total float |
|---|---|---|---|---|---|
| A | 0 | 3 | 0 | 3 | 0 |
| B | 3 | 8 | 3 | 8 | 0 |
| C | 3 | 7 | 4 | 8 | 1 |
| D | 8 | 11 | 8 | 11 | 0 |
Total float is LS - ES, which is the same as LF - EF. It is the number of days an activity can slip without delaying the project. The critical activities are those with zero float: A, B and D. C has 1 day of float, which matches the 11 versus 10 day path lengths. The next chapter covers float in detail.
Doing it in code
The code below runs both passes. The dictionary lists activities in dependency order, so every predecessor appears before the activities that depend on it.
activities = {
"A": {"dur": 3, "preds": []},
"B": {"dur": 5, "preds": ["A"]},
"C": {"dur": 4, "preds": ["A"]},
"D": {"dur": 3, "preds": ["B", "C"]},
}
# Forward pass: early start and early finish
es, ef = {}, {}
for name, a in activities.items():
es[name] = max((ef[p] for p in a["preds"]), default=0)
ef[name] = es[name] + a["dur"]
duration = max(ef.values())
# Build the successor lists the backward pass needs
succs = {name: [] for name in activities}
for name, a in activities.items():
for p in a["preds"]:
succs[p].append(name)
# Backward pass: late finish and late start
ls, lf = {}, {}
for name in reversed(list(activities)):
lf[name] = min((ls[s] for s in succs[name]), default=duration)
ls[name] = lf[name] - activities[name]["dur"]
print(f"Project duration: {duration} days")
critical = []
for name in activities:
total_float = ls[name] - es[name]
flag = "critical" if total_float == 0 else ""
print(f"{name}: ES={es[name]} EF={ef[name]} LS={ls[name]} LF={lf[name]} float={total_float} {flag}")
if total_float == 0:
critical.append(name)
print("Critical path:", " -> ".join(critical))Running it prints a project duration of 11 days and the critical path A -> B -> D. Activity C shows a float of 1.
The final line joins the zero-float activities in the order they were listed. That order is only meaningful here because the critical activities form one chain. With several critical chains, you would need to trace successors to separate them.
Edge cases to watch for
More than one critical path
If B had been 4 days instead of 5, both paths would be 10 days. Both would have zero float, and both would be critical. Compressing one of them would not shorten the project, because the other still sets the finish. This matters for crashing later: when paths tie, you have to shorten all of them, which costs more.
Near-critical paths
Here C has 1 day of float. A near-critical path is a path whose length is close to the critical path. If you crash B by two days, the critical path stops being A-B-D. The path through C becomes the longest, at 10 days, so the project only shortens by 1 day. Always recompute the critical path after each change.
The critical path can move
The critical path is not fixed for the life of the project. A delay on a non-critical activity can use up its float and turn it critical. Compression changes durations and can also move the critical path. Treat it as a result you recompute, not a label you assign once.
The longest activity is not necessarily critical
An activity's own duration is not what makes it critical. What matters is the total length of the path it sits on. A 10-day activity on a short branch can have lots of float, while a 1-day activity on the longest chain has none.
Activities with no successors
Every activity must connect to the project finish. An activity with no successor that is not meant to be the last one is a modeling error. The backward pass would give it LF equal to the project duration and a large float. The schedule would then hide its real effect on the end date. Check for these "dangling" activities when you review a network.
Durations, calendars and constraints
The arithmetic above uses plain day counts. Real schedules use working-day calendars, so a 5-day activity that starts on Thursday finishes the next Wednesday. Scheduling tools handle this for you. Fixed dates, resource limits and lags can also change which path is critical. This chapter covers the pure precedence logic.
Common mistakes
- Adding every duration. The project duration is the length of the longest path, not the sum of all durations. Summing A through D gives 15 days, but the project takes 11.
- Using the larger LS in the backward pass. Taking the smallest successor LS is what keeps every successor on time.
- Using the smaller EF in the forward pass. An activity can only start when all its predecessors are done, so take the largest EF.
- Declaring the critical path once. Recompute after any change to a duration or dependency.
- Treating zero float as the same as unimportant to compress. Zero float tells you an activity is critical. It does not tell you that compressing it is affordable, which depends on cost slope.
Link to compression
The critical path tells you where to act. Only critical activities can shorten the project. In the example, shortening C from 4 days to 3 gives no gain at all, since the path through B still takes 11 days. Shortening B by one day gives a one-day gain, because B is critical. The first crashing example later in the course applies this rule: it only crashes an activity if doing so makes the project shorter.
Exercise
A network has these activities: P (4 days, no predecessors), Q (6 days, after P), R (3 days, after P), S (5 days, after R), T (2 days, after Q and S). What is the critical path, the project duration, and the total float of Q?
Show answer
There are two paths. P-Q-T is 4 + 6 + 2 = 12 days. P-R-S-T is 4 + 3 + 5 + 2 = 14 days. The critical path is P, R, S, T and the project duration is 14 days. Q has ES = 4 and EF = 10. T has ES = 10 from Q but ES = 12 from S, so T starts at day 12, and LF for Q is 12 and LS is 6. The total float of Q is 6 - 4 = 2 days. Q is the longest single activity, but it is not critical.
Exercise
In the example network of this chapter, you shorten B from 5 days to 3 days. What is the new project duration, and which activities are critical afterwards?
Show answer
Path A-B-D becomes 3 + 3 + 3 = 9 days. Path A-C-D is still 3 + 4 + 3 = 10 days. The project duration is 10 days, not 9, because the path through C is now the longest. The critical path is A, C, D. The second day of shortening on B bought nothing, since the critical path moved to C after the first day.