Dependency Graphs Math Example 3
Follow the full solution, then compare it with the other examples linked below.
Example 3
mediumTasks , , , . What is the minimum number of stages to complete all tasks if independent tasks can run in parallel?
Solution
- 1 Draw the dependency graph: has no prerequisites; and both depend on ; depends on both and .
- 2 Determine stages by levels: Stage 1: (no dependencies). Stage 2: and (both depend only on , so they run in parallel). Stage 3: (depends on and , both completed in Stage 2).
- 3 The critical path is (or ), each of length 3. So the minimum number of stages is .
Answer
The minimum number of stages equals the length of the longest path (critical path) in the dependency graph. Even though there are 4 tasks, and can execute in parallel during Stage 2, reducing the total from 4 sequential steps to 3 stages.
About Dependency Graphs
A dependency graph is a directed graph where nodes are variables and arrows show which variables directly influence which others.
Learn more about Dependency Graphs βMore Dependency Graphs Examples
Example 1 easy
Three tasks have the following dependencies: Task B depends on Task A, and Task C depends on Task B.
Example 2 mediumGiven the dependencies: [formula] depends on [formula] and [formula]; [formula] depends on [formula]
Example 4 mediumA project has tasks with dependencies: [formula] depends on [formula]; [formula] depends on [formula
Example 5 hardGiven the dependency graph with edges [formula], [formula], [formula], [formula], [formula], [formul