because of the construction aboveif (vi,vjis an edge of then vi must be deleted before vj can be deletedand thus < thusv vn is topological ordering proposition ' justification suggests an algorithm (code fragment )called topological sortingfor computing topological ordering of digraph code fragment pseudo-code for the topological sorting algorithm (we show an example application of this algorithm in figure proposition let be digraph with vertices andm edges the topological sorting algorithm runs in ( mtime using (nauxiliary spaceand either computes topological ordering of which indicates that or fails to number some verticeshas directed cycle