Overview

  • Works on a dag

Methods

// end unknown
Call DFS(G) to compute finish times v.f for each vertex v
as each vertex is fnished, insert it onto the front of a linked list
return the linked list of vertices

// end known
-> bool
1. 选择图中一个入度为0的点,记录下来
2. 在图中删除该点和所有以它为起点的边
3. 重复1和2,直到图为空或没有入度为0的点。

Analysis