The literal reading of Kahn's algorithm is: scan the graph for a vertex nothing points at, remove it, scan again. That is correct and it costs V passes over the whole graph. The counter turns the scan into bookkeeping - one pass counts every incoming edge up front, and after that each edge is walked once more, when its source is placed, to decrement exactly one counter. A vertex joins the ready queue at the instant its last prerequisite is placed, so nothing is ever rescanned and the total work stays at V + E.