Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M9920

Topological Sort

Topological Sort
BusinessHigh supportManagement
Included
account_tree

Updated 2026-07-30

Loading revision record…

Summary

In computer science, a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge (u,v) from vertex u to vertex v, u comes before v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, a…

Definition

Sorting the vertices of a directed acyclic graph so that the start of every edge comes before its end—that is, ordering tasks according to dependencies. Scaffold use: clarify the order of precedence. Identify which tasks must be completed before starting the next.

How to use

Clarify the order of precedence. Identify which tasks must be completed before starting the next.

Mechanism

Topological sort arranges the nodes of a directed acyclic graph (DAG) into a linear order such that every edge points from earlier to later, expressing precedence dependencies. It is the foundation for scheduling tasks with dependencies.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Scheduling courses based on prerequisites. The compilation dependency order in software builds is a topological sort.

Common pitfalls

  • Neglecting cycle detection, forcing a sort on a cyclic graph leads to errors. Mistaking topological order for a total order, ignoring parts that can be parallelized.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Topological_sortingZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS