Network::topSort
-- topological
sorting of the nodes
computes a topological
sorting of the network Network::topSort
(G)G
, i.e., a numbering T
of the nodes, such that T[i] < T[j] whenever there is an
edge [i,j] in the network.
Network::topSort(G)
G |
- | network |
a table of nodes.
G
contains any cycle then a topological sorting
does not exist and the call of Network::topSort
results in
an error.>> Network([1,2,3,4],[[1,2],[2,4],[3,4]]): Network::topSort(%)
table( 4 = 4, 2 = 3, 3 = 2, 1 = 1 )
>> Network::topSort(Network::complete(3))
Error: Network contains cycle [Network::topSort]
Network::TopSort