Skip to main content

Topological Sorting

Topological sort answers the question, “If I have a list of directions saying that one task must be done before another, what is a valid ordering of all tasks?” To formalize this problem, we will represent the constraint of task a being before task b as a directed edge from a to b in a graph where tasks are nodes. This graph can not feasibly have cycles, because that would mean that in order to begin a task, we must have already completed that task.