Chapter 5 · Simulation

Topological Sort, SCC and Articulation Points

← Chapter 5
DAG

Graph Structure Algorithms

Three graph structure algorithms run on small sample graphs. Each button loads its own sample graph and runs the algorithm on it.

How to use

  • Topological Sort: runs Kahn's algorithm on a directed acyclic graph (DAG). The badge on each node shows its place in the order.
  • SCC: runs Kosaraju's algorithm on a directed graph; each strongly connected component gets its own color and a dashed frame.
  • Articulation Points: runs the DFS low-link method on an undirected graph; articulation points are highlighted and the edges of the DFS tree are drawn thick.
  • Reset: shows the DAG without a result.

Notes

Topological sorting applies only to DAGs. Strongly connected components split a directed graph into the largest groups in which every node can reach every other. Articulation points are the nodes whose removal from an undirected graph increases the number of components.

AlgorithmIdeaTime
Kahn (topological sort)Repeatedly remove a node with in-degree 0O(V + E)
Kosaraju (SCC)DFS finishing order, then DFS on the reversed graphO(V + E)
Articulation pointsDFS with discovery times and low-link valuesO(V + E)

A non-root node u is an articulation point if low[v] ≥ disc[u] for some DFS child v; the DFS root is an articulation point if it has more than one DFS child.