version 1.15, 2004/08/04 15:29:10 |
version 1.16, 2004/08/04 15:30:06 |
|
|
.Nd topological sort of a directed graph |
.Nd topological sort of a directed graph |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm tsort |
.Nm tsort |
.Op Fl f |
.Op Fl flqrvw |
.Op Fl h Ar file |
.Op Fl h Ar file |
.Op Fl l |
|
.Op Fl q |
|
.Op Fl r |
|
.Op Fl v |
|
.Op Fl w |
|
.Op Ar file |
.Op Ar file |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm tsort |
.Nm tsort |
takes a list of pairs of node names representing directed arcs in |
takes a list of pairs of node names representing directed arcs in |
a graph and prints the nodes in topological order on standard output. |
a graph and prints the nodes in topological order on standard output. |
That is: the input describes a partial ordering relation, from which |
That is, the input describes a partial ordering relation, from which |
.Nm |
.Nm |
computes a total order compatible with this partial ordering. |
computes a total order compatible with this partial ordering. |
.Pp |
.Pp |
|
|
.El |
.El |
.Sh EXAMPLES |
.Sh EXAMPLES |
Faced with the input: |
Faced with the input: |
.Bd -literal |
.Bd -literal -offset indent |
a b |
a b |
b c |
b c |
b d |
b d |
|
|
.Pp |
.Pp |
.Nm |
.Nm |
outputs: |
outputs: |
.Bd -literal |
.Bd -literal -offset indent |
a |
a |
b |
b |
c |
c |
|
|
.Pp |
.Pp |
which is one total ordering compatible with the individual relations. |
which is one total ordering compatible with the individual relations. |
There is no unicity, another compatible total ordering would be: |
There is no unicity, another compatible total ordering would be: |
.Bd -literal |
.Bd -literal -offset indent |
a |
a |
b |
b |
c |
c |