tsort - topological sort
tsort [filename]
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.
breadth-first or depth-first (default) traversal
Optional input file. Input format is pairs of white-space-separated fields, one pair per line. Each field is the name of a node.
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(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)
To install PerlPowerTools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PerlPowerTools
CPAN shell
perl -MCPAN -e shell install PerlPowerTools
For more information on module installation, please visit the detailed CPAN module installation guide.