0% found this document useful (0 votes)
64 views

The Stony Brook Algorithm Repository: 1.4.2 Topological Sorting

Topological sorting orders the vertices of a directed acyclic graph (DAG) such that for every edge from vertex A to vertex B, A appears before B in the ordering. It can be used to schedule tasks that have precedence constraints. Topological sorting finds a linear ordering of the vertices such that no vertex comes before any of its predecessors. Implementations of topological sorting include those in Boost, LEDA, JGraphT, and JDSL libraries.

Uploaded by

sangtao
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

The Stony Brook Algorithm Repository: 1.4.2 Topological Sorting

Topological sorting orders the vertices of a directed acyclic graph (DAG) such that for every edge from vertex A to vertex B, A appears before B in the ordering. It can be used to schedule tasks that have precedence constraints. Topological sorting finds a linear ordering of the vertices such that no vertex comes before any of its predecessors. Implementations of topological sorting include those in Boost, LEDA, JGraphT, and JDSL libraries.

Uploaded by

sangtao
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.4.

2 Topological Sorting

http://www.cs.sunysb.edu/~algorith/files/topological-sorting.shtml

The Stony Brook Algorithm Repository


Steven Skiena Stony Brook University Dept. of Computer Science
By Language
About the Book

By Problem

Algorithm Links

1.4.2 Topological Sorting

INPUT

OUTPUT

Input Description: A directed, acyclic graph G=(V,E) (also known as a partial order or poset). Problem: Find a linear ordering of the vertices of V such that for each edge (i,j) \in E, vertex i is to the left of vertex j. Excerpt from The Algorithm Design Manual: Topological sorting arises as a natural subproblem in most algorithms on directed acyclic graphs. Topological sorting orders the vertices and edges of a DAG in a simple and consistent way and hence plays the same role for DAGs that depth-first search does for general graphs. Topological sorting can be used to schedule tasks under precedence constraints. Suppose we have a set of tasks to do, but certain tasks have to be performed before other tasks. These precedence constraints form a directed acyclic graph, and any topological sort (also known as a linear extension) defines an order to do these tasks such that each is performed only after all of its constraints are satisfied.

Implementations
Boost: C++ Libraries (C++) (rating 10) LEDA - A Library of Efficient Data Types and Algorithms (C++) (rating 9) JGraphT: Java graph library (Java) (rating 8) JDSL: Java Data Structures Libary (Java) (rating 8) Algorithms in C++ -- Sedgewick (C++) (rating 3) Moret and Shapiro's Algorithms P to NP (Pascal) (rating 3)

Recommended Books
Algorithms in Java, Third Edition (Parts 1-4) by Robert Sedgewick and Michael Schidlowsky Introduction to Algorithms by T. Cormen and C. Leiserson and R. Rivest and C. Stein Introduction to Algorithms by U. Manber

1 of 2

22/05/2012 6:33 PM

1.4.2 Topological Sorting

http://www.cs.sunysb.edu/~algorith/files/topological-sorting.shtml

Related Problems

Bandwidth Reduction

Feedback Edge/Vertex Set

Job Scheduling

Sorting

This page last modified on 2008-07-10 . www.algorist.com

2 of 2

22/05/2012 6:33 PM

You might also like