NAME

tsort - topological sort

SYNOPSIS

tsort [filename]

DESCRIPTION

    Does a topological sort of input pairs.

    For a more complete description, see the tsort(1) man page, For an explanation of the algorithm, see the Work column in the October, 1998, issue of SunExpert, or the references given below.

OPTIONS AND ARGUMENTS

[-b|-d]

breadth-first or depth-first (default) traversal

filename

Optional input file. Input format is pairs of white-space-separated fields. Each field is the name of a node. Output is the topologically sorted list of nodes.

AUTHOR

Jeffrey S. Haemer

SEE ALSO

tsort(1), tcsh(1), tchrist(1)

Algorithm stolen from Jon Bentley (More Programming Pearls, pp. 20-23), who, in turn, stole it from Don Knuth (Art of Computer Programming, volume 1: Fundamental Algorithms, Section 2.2.3)