GraphTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/TopologicSort

GraphTheory

 TopologicSort

 Calling Sequence TopologicSort(G)

Parameters

 G - acyclic directed graph

Description

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{DG}≔\mathrm{Digraph}\left(\left\{\left[c,a\right],\left[c,b\right],\left[c,d\right],\left[a,d\right],\left[b,d\right],\left[a,b\right]\right\}\right):$
 > $\mathrm{IsAcyclic}\left(\mathrm{DG}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{TopologicSort}\left(\mathrm{DG}\right)$
 $\left[{c}{,}{a}{,}{b}{,}{d}\right]$ (2)