top_sort(+Graph,
-Sort)Generate the set of nodes Sort as a topological sorting of
Graph, if one is possible. A toplogical sort is possible if
the graph is connected and acyclic. In the example we show how
topological sorting works for a linear graph:
?- top_sort([1-[2], 2-[3], 3-[]], L).
L = [1, 2, 3]