Download presentation

Presentation is loading. Please wait.

Published byKristina Blyth Modified about 1 year ago

1
Chapter 9: Graphs Scheduling Networks Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College

2
2 Scheduling Networks Definitions Purpose of the Model Algorithm Critical Activities Complexity Example

3
3 Definitions A project can be described by its activities, their duration and the prerequisites of each activity Activity: a task, characterized by: duration prerequisites – other tasks that have to be completed in order to start the current task Event: a point in time, characterized by the completion of one or several activities

4
4 The Model Directed simple acyclic graph Nodes: events Source: starting event Sink: terminating event Edges: activities Each edge is labeled by a pair (name of the task, duration), duration 0 Simple graph means: each pair of nodes connected by at most one edge

5
5 Purpose of the Model Find the earliest occurrence time (EOT) of an event Find the earliest completion time (ECT) of an activity Find the slack of an activity: how much the activity can be delayed without delaying the project Find the critical activities: must be completed on time in order not to delay the project

6
6 EOT and ECT Earliest occurrence time of an event EOT(source) = 0 EOT( j ) = max ( ECTs of all activities preceding the event) Earliest completion time of an activity ECT( j, k ) = EOT( j ) + duration( j, k)

7
7 Algorithm to Compute EOT and ECT 1. Sort the nodes topologically 2. For each event j : initialize EOT(j) = 0 3. For each event i in topological order For each event j adjacent from i : ECT(i,j) = EOT(i) + duration (i,j) EOT(j) = max(EOT(j), ECT(i,j))

8
8 Algorithm to find the slack of activities Compute latest occurrence time LOT(j), slack(i, j) 1. InitializeLOT(sink) = EOT(sink) 2. For each non-sink event i in the reverse topological order: LOT(i) = min(LOT( j ) – duration( i, j)) 3. For each activity (i,j) slack( i, j ) = LOT( j ) – ECT( i, j)

9
9 Critical Activities, Complexity Critical activities: slack(j) = 0 Critical path in the project: all edges are activities with slack = 0 The critical path is found using breadth-first (or depth-first) search on the edges Complexity: O(V + E) with adjacency lists, O(V 2 ) with adjacency matrix

10
10 Example d / 2 a / 2 f / b / 1 e / 10 g / 9 c / 11 h / 4 Topological sort: 1, 4, 2, 3, 5, 6 Critical Path: 1, 4, 2, 5, 6

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google