Skip to content
Data Structures and Algorithms / Graphs: Representation, Traversal, and Decomposition

Topological Sort and Strongly Connected Components

A factor model that depends on other factor models, or a settlement obligation that must clear before another can be processed, both impose a partial order on a set of tasks — and the two classical questions about such a directed graph are: (1) is there a valid execution order at all, and if so what is it (topological sort), and (2) which groups of vertices are mutually reachable from each other, forming tightly coupled clusters within an otherwise acyclic macro-structure (strongly connected components)? Both questions are answered by post-processing a single DFS run.

In this lesson

  1. Learning objectives
  2. Topological sort
  3. Strongly connected components

Before you start

The full lesson, with worked examples and exercise solutions, is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or explore the curriculum.