[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.4 tsort: Topological sort

tsort performs a topological sort on the given file, or standard input if no input file is given or for a file of `-'. Synopsis:

 
tsort [option] [file]

tsort reads its input as pairs of strings, separated by blanks, indicating a partial ordering. The output is a total ordering that corresponds to the given partial ordering.

For example

 
tsort <<EOF
a b c
d
e f
b c d e
EOF

will produce the output

 
a
b
c
d
e
f

tsort will detect cycles in the input and writes the first cycle encountered to standard error.

Note that for a given partial ordering, generally there is no unique total ordering.

The only options are `--help' and `--version'. See section 2. Common options.



This document was generated by Paul Visscher on December, 28 2000 using texi2html