# DS10_Ch09b - 2 Topological Sort Example Courses needed for...

This preview shows pages 1–4. Sign up to view the full content.

§2 Topological Sort 〖 Example 〖 Courses needed for a computer science degree at a hypothetical university Course number Course name Prerequisites C1 Programming I None C2 Discrete Mathematics None C3 Data Structure C1, C2 C4 Calculus I None C5 Calculus II C4 C6 Linear Algebra C5 C7 Analysis of Algorithms C3, C6 C8 Assembly Language C3 C9 Operating Systems C7, C8 C10 Programming Languages C7 C11 Compiler Design C10 C12 Artificial Intelligence C7 C13 Computational Theory C7 C14 Parallel Algorithms C13 C15 Numerical Analysis C6 How shall we convert this list into a graph? 1/12

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
§2 Topological Sort AOV Network ::= digraph G in which V( G ) represents activities ( e.g. the courses ) and E( G ) represents precedence relations ( e.g. means that C1 is a prerequisite course of C3 ). C1 C3 i is a predecessor of j ::= there is a path from i to j i is an immediate predecessor of j ::= < i , j > E( G ) Then j is called a successor ( immediate successor ) of i Partial order ::= a precedence relation which is both transitive ( i k , k j i j ) and irreflexive ( i i is impossible ). Feasible AOV network must be a Feasible AOV network must be a dag dag (directed acyclic graph). (directed acyclic graph). Note: If the precedence relation is reflexive, then there must be an i such that i is a predecessor of i . That is, i must be done before i is started. Therefore if a project is feasible, it must be irreflexive. Note: If the precedence relation is reflexive, then there must be an i such that i is a predecessor of i . That is, i must be done before i is started. Therefore if a project is feasible , it must be irreflexive . 2/12
§2 Topological Sort Definition A topological order is a linear ordering of the vertices of a graph such that, for any two vertices, i , j , if i is a predecessor of j in the network then i precedes j in the linear ordering.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

DS10_Ch09b - 2 Topological Sort Example Courses needed for...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online