Topological Sort Example This job consists of 10 tasks with the following precedence rules: Must start with 7, 5, 4 or 9. Task 1 must follow 7. Tasks 3.

Slides:



Advertisements
Similar presentations
Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
Advertisements

Factoring with Algebra Tiles
Parallel List Ranking Advanced Algorithms & Data Structures Lecture Theme 17 Prof. Dr. Th. Ottmann Summer Semester 2006.
Some Graph Algorithms.
Computer Science 112 Fundamentals of Programming II Overview of Collections.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Topological Sort.
Data Structures Using C++
Topological Sort and Hashing
Graph Algorithms: Topological Sort The topological sorting problem: given a directed, acyclic graph G = (V, E), find a linear ordering of the vertices.
Data Structures Using C++ 2E1 Topic of this lecture: Topological Order OU CS prerequisite bubble chart
Data Structures Using C++
SEARCHING, SORTING, TOPOLOGICAL SORTS Most real world computer applications deal with vast amounts of data. Searching for a particular data item can take.
Презентація за розділом “Гумористичні твори”
Галактики і квазари.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Selection Sort
Advanced Topics in Algorithms and Data Structures 1 Two parallel list ranking algorithms An O (log n ) time and O ( n log n ) work list ranking algorithm.
Topological Sort Introduction. Definition of Topological Sort. Topological Sort is Not Unique. Topological Sort Algorithm. An Example. Implementation.
Objective: Students will add integers using models and rules (11-3).
Chapter 14 Graphs. © 2004 Pearson Addison-Wesley. All rights reserved Terminology G = {V, E} A graph G consists of two sets –A set V of vertices,
 A _____________________ is any set of ordered pairs that express a relationship.  A _____________________ is a relationship between two variables. This.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
9.4 factoring to solve quadratic equations.. What are the roots of a quadratic function? Roots (x-intercepts): x values when y = 0 ( ___, 0) How do you.
Selection Sort
Roots, Zeroes, and Solutions For Quadratics Day 2.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Which of the following pictures of m & m’s is easier to count?
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
Domain: a set of first elements in a relation (all of the x values). These are also called the independent variable. Range: The second elements in a relation.
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
1 Job Shop Scheduling. 2 Job shop environment: m machines, n jobs objective function Each job follows a predetermined route Routes are not necessarily.
© 2006 Pearson Addison-Wesley. All rights reserved14 B-1 Chapter 14 (continued) Graphs.
Topological Sort. Sorting technique over DAGs (Directed Acyclic Graphs) It creates a linear sequence (ordering) for the nodes such that: –If u has an.
Functions and relations
Fundamentals of Programming II Overview of Collections
Goal: use counters to add integers
Introducing Do While & Do Until Loops & Repetition Statements
Functions and relations
More Graph Algorithms.
Topological Sort.
Arrays and Linked Lists
Order Pairs An introduction.
Topological Sort.
Significant Figures.
"Learning how to learn is life's most important skill. " - Tony Buzan
Richard Anderson Autumn 2016 Lecture 5
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Безопасност на движението
Richard Anderson Winter 2009 Lecture 6
MATCHSTICKS are arranged to make simple patterns. Nature likes repetition of patterns. Engineering has many examples of repeating patterns.
Objective- To use an equation to graph the
Introduction to Repetition
Some Graph Algorithms.
Introduction to Repetition
Analyzing Patterns 5.OA.B.3.
f(x) y x A function is a relation that gives a single
Objective- To graph a relationship in a table.
Richard Anderson Lecture 5 Graph Theory
Presentation transcript:

Topological Sort Example This job consists of 10 tasks with the following precedence rules: Must start with 7, 5, 4 or 9. Task 1 must follow 7. Tasks 3 & 6 must follow both 7 & 5. 8 must follow 6 & 4. 2 must follow must follow 2. Make a directed graph and then a list of ordered pairs that represent these relationships.

Tasks listed as ordered pairs: 7,1 7,3 7,6 5,3 5,6 6,8 4,8 4,2 2,10 Tasks shown as a directed graph.

Predecessor CountsSuccessors

Place all tasks that have zero predecessors in a “bag”. BAGBAG Step 1. Remove any task from the bag and place in sorted list. BAGBAG Step 2. Update Predecessor and Successor arrays as needed. Sorted List: 7,

Predecessor CountsSuccessors 136

Step 3. Add to bag any tasks that now have zero predecessors. BAGBAG Step. 4. Repeat steps 1, 2, and 3 until all predecessor counts are -1. (We are performing a “loop” or repetition.)