mdoc version three
[unix-history] / usr / src / usr.bin / tsort / tsort.1
CommitLineData
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
21takes a list of pairs of node names representing directed arcs in
22a graph and prints the nodes in topological order on standard output.
8f5f4c1c
CL
23Input is taken from the named
24.Ar file ,
25or from standard input if no file
07d825db 26is given.
8f5f4c1c 27.Pp
07d825db
KB
28Node names in the input are separated by white space and there must be an
29even number of nodes.
8f5f4c1c 30.Pp
07d825db
KB
31Presence of a node in a graph can be represented by an arc from the node
32to itself.
33This is useful when a node is not connected to any other nodes.
8f5f4c1c 34.Pp
07d825db
KB
35If the graph contains a cycle (and therefore cannot be properly sorted),
36one of the arcs in the cycle is ignored and the sort continues.
37Cycles are reported on standard error.
8f5f4c1c
CL
38.Sh SEE ALSO
39.Xr ar 1
40.Sh HISTORY
41A
42.Nm
43command appeared in
44.At v7 .
45This
46.Nm tsort
47command and manual page are derived from sources contributed to Berkeley by
48Michael Rendell of Memorial University of Newfoundland.