TopologicalSort
gives a list of vertices of g in topologically sorted order for a directed acyclic graph g.
TopologicalSort[{vw,…}]
uses rules vw to specify the graph g.
Details

- TopologicalSort is also known as topological ranking or topological ordering.
- A list of vertices is topologically sorted if u precedes v for each edge uv.

Examples
open allclose allScope (6)
TopologicalSort works with directed graphs:
TopologicalSort only works with acyclic graphs:
Text
Wolfram Research (2010), TopologicalSort, Wolfram Language function, https://reference.wolfram.com/language/ref/TopologicalSort.html (updated 2015).
CMS
Wolfram Language. 2010. "TopologicalSort." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/TopologicalSort.html.
APA
Wolfram Language. (2010). TopologicalSort. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TopologicalSort.html