Commit | Line | Data |
---|---|---|
07d825db KB |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
d8e69841 | 3 | .\" |
07d825db KB |
4 | .\" This manual is derived from one contributed to Berkeley by |
5 | .\" Michael Rendell of Memorial University of Newfoundland. | |
8f5f4c1c | 6 | .\" %sccs.include.redist.roff% |
07d825db | 7 | .\" |
8f5f4c1c | 8 | .\" @(#)tsort.1 6.3 (Berkeley) %G% |
07d825db | 9 | .\" |
8f5f4c1c CL |
10 | .Dd |
11 | .Dt TSORT 1 | |
12 | .Os | |
13 | .Sh NAME | |
14 | .Nm tsort | |
15 | .Nd topological sort of a directed graph | |
16 | .Sh SYNOPSIS | |
17 | .Nm tsort | |
18 | .Op Ar file | |
19 | .Sh DESCRIPTION | |
20 | .Nm Tsort | |
07d825db KB |
21 | takes a list of pairs of node names representing directed arcs in |
22 | a graph and prints the nodes in topological order on standard output. | |
8f5f4c1c CL |
23 | Input is taken from the named |
24 | .Ar file , | |
25 | or from standard input if no file | |
07d825db | 26 | is given. |
8f5f4c1c | 27 | .Pp |
07d825db KB |
28 | Node names in the input are separated by white space and there must be an |
29 | even number of nodes. | |
8f5f4c1c | 30 | .Pp |
07d825db KB |
31 | Presence of a node in a graph can be represented by an arc from the node |
32 | to itself. | |
33 | This is useful when a node is not connected to any other nodes. | |
8f5f4c1c | 34 | .Pp |
07d825db KB |
35 | If the graph contains a cycle (and therefore cannot be properly sorted), |
36 | one of the arcs in the cycle is ignored and the sort continues. | |
37 | Cycles are reported on standard error. | |
8f5f4c1c CL |
38 | .Sh SEE ALSO |
39 | .Xr ar 1 | |
40 | .Sh HISTORY | |
41 | A | |
42 | .Nm | |
43 | command appeared in | |
44 | .At v7 . | |
45 | This | |
46 | .Nm tsort | |
47 | command and manual page are derived from sources contributed to Berkeley by | |
48 | Michael Rendell of Memorial University of Newfoundland. |