TopologicalSort - compute a linear ordering consistent with a given partial ordering
|
Calling Sequence
|
|
TopologicalSort(rel::{list, set}([anything, anything]))::list
|
|
Parameters
|
|
rel
|
-
|
partial order specified as a list or set of pairs
|
|
|
|
|
Description
|
|
•
|
It is also possible that no linear ordering consistent with the given partial order exists. This is the case when the directed graph contains a cycle. If TopologicalSort detects a cycle in the graph, then an exception is raised. The simplest example of this is the relation , which clearly has no consistent linear order.
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
Sort subexpressions of an expression by containment.
>
|
|
| (3) |
>
|
|
| (4) |
| (5) |
|
|
Download Help Document
Was this information helpful?