Finding Kernel in DAG
Let's start the algorithm with these 3 sets:


$V$ = {all vertices}
$K$ = {}
$K'$ = {}


with the semantics:


$V$ stores unprocessed vertices
$K$ stores vertices known to be in the kernel
$K'$ stores vertices known to be outside the kernel


You're right that all vertices without incoming edges always belongs to the kernel. Add the them to the set $K$ &amp; remove from $V$.

The next step is realizing that any vertices that can be immediately reached from vertices in the current $K$ must be outside the kernel. Add these to $K'$ &amp;  remove from $V$.

Now, all the vertices that is left in $V$ without incoming edges (from other vertices inside $V$) again can be added to $K$ (and remove from $V$).

...

Repeat the process until $V$ is empty.