1 / 8

Topological Sort Neil Tang 03/02/2010

Topological Sort Neil Tang 03/02/2010. Class Overview. Basic concepts An application Algorithm 1 Algorithm 2. Basic Concepts. A topological sort is an ordering of vertices in a DAG , such that if there is a path from v i to v j , then v j appears after v i in the ordering.

cullenl
Download Presentation

Topological Sort Neil Tang 03/02/2010

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. Topological Sort Neil Tang03/02/2010 CS223 Advanced Data Structures and Algorithms

  2. Class Overview • Basic concepts • An application • Algorithm 1 • Algorithm 2 CS223 Advanced Data Structures and Algorithms

  3. Basic Concepts • A topological sort is an ordering of vertices in a DAG, such that if there is a path from vi to vj, then vj appears after vi in the ordering. • The topological sort may not be unique for a DAG. • Indegree/outdegree: the number of incoming/outgoing edges CS223 Advanced Data Structures and Algorithms

  4. An Example Ordering 1: 1,2,5,4,3,7,6 Ordering 2: 1,2,5,4,7,3,6 CS223 Advanced Data Structures and Algorithms

  5. An Application CS223 Advanced Data Structures and Algorithms

  6. Topological Sort: Algorithm 1 Time complexity: O(|V|2) CS223 Advanced Data Structures and Algorithms

  7. Topological Sort: Algorithm 2 Time complexity: O(|V|+|E|) CS223 Advanced Data Structures and Algorithms

  8. Topological Sort: Algorithm 2 CS223 Advanced Data Structures and Algorithms

More Related