1 / 10

Chapter 9: Graphs

Mark Allen Weiss: Data Structures and Algorithm Analysis in Java. Chapter 9: Graphs. Scheduling Networks. Lydia Sinapova, Simpson College. Scheduling Networks. Definitions Purpose of the Model Algorithm Critical Activities Complexity Example. Definitions.

misty
Télécharger la présentation

Chapter 9: Graphs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  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. 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. 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. 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. 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. Algorithm to find the slack of activities Compute latest occurrence time LOT(j) , slack(i, j) 1. Initialize LOT(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. 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(V2) with adjacency matrix

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

More Related