Topological Sort

noun

say it: “top-uh-LOJ-ih-kul SORT” /ˌtɑpəˈlɑdʒɪkəl sɔrt/

An order for tasks with "this before that" rules in which every task comes after everything it depends on.

What is a topological sort?

A topological sort puts tasks in an order that keeps every "this before that" rule: every prerequisite comes before the course that needs it. One way: count what each task waits on, take tasks that wait on nothing, and cross each one off the tasks it unlocks. It's impossible when the rules form a loop.

In a sentence

  • “The planning app runs a topological sort on the catalog, so no course is scheduled before its prerequisites.”

Level: Freelancer · More Data Structures terms at this level

Updated