This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: DAGs and Topological Ordering
A directed acyclic graph (DAG) is a
digraph that has no directed cycles
A topological ordering of a digraph
is a numbering D v1 , …, vn B of the vertices such that for every
edge (vi , vj), we have i < j C
DAG G A Example: in a task scheduling
digraph, a topological ordering is a
task sequence that satisfies the
precedence constraints v4
D v2 Theorem B A digraph admits a topological
ordering if and only if it is a DAG A
 76  v5
E v3
C v1 CSE 2011
Prof. J. Elder E Topological
ordering of G Last Updated: 4/1/10 2:37 PM Linear Order
Alg: DFS a
h
i
j
k b
c
d
e
g
f CSE 2011
Prof. J. Elder Found
Not Handled
Stack f
g
e
d l  77  ….. f Last Updated: 4/1/10 2:37 PM Linear Order
Alg: DFS a
h
i
j
k b
c
d
e
g
f Found
Not Handled
Stack l
g
e
d l When node is popped off stack, insert at front of linearlyordered “to do” list.
Linear Order:
CSE 2011
Prof. J. Elder  78  ….. f Last Updated: 4/1/10 2:37 PM Linear Order Found
Not Handled
Stack Alg: DFS a
h
i
j
k b
c
d
e
g
f g
e
d l
Linear Order: CSE 2011
Prof. J. Elder  79  l,f Last Updated: 4/1/10 2:37 PM BFS Example
A undiscovered A discovered (on Queue) A finished
unexplored edge A L1 B discovery edge C
E D
F cross edge L0
L1 L0 A B C
E CSE 2011
Prof. J. Elder L1 D
F A B C
E  80  D
F Last Updated: 4/1/10 2:37 PM ...
View
Full
Document
This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.
 Fall '11
 Elder
 Data Structures

Click to edit the document details