tcsort [filename]
For a more complete description, see the tsort
man page, For
an explanation of the algorithm, see the Work column in the October, 1998, issue of SunExpert, or the references given
below.
Output is the topologically sorted list of nodes.
Ignores lines without at least two fields. Ignores all fields on the line except the first two.
Jeffrey S. Haemer
tsort,
tcsh,
tchrist
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)