GraphTheory
TopologicSort
compute topological order
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
TopologicSort(G)
G
-
acyclic directed graph
output = one of default or permutation
When output=permutation, returns a list of integers representing the permutation to Vertices(G) to obtain the topological order. When output=default, a list of the actual vertices is returned.
The TopologicSort command returns a linear ordering of vertices of an acyclic digraph that is consistent with the arcs of the digraph. This means a vertex u precedes a vertex v if there is an arc from u to v. The output is a list.
with⁡GraphTheory:
DG≔Digraph⁡a,b,a,d,b,d,c,a,c,b,c,d:
IsAcyclic⁡DG
true
TopologicSort⁡DG
c,a,b,d
The GraphTheory[TopologicSort] command was updated in Maple 2021.
The output option was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
Digraph
IsAcyclic
TopologicalSort
Download Help Document