Let's say that there is one vertex with the following property in a DAG:
All vertices are connected to it
It is not connected to any vertex
This is usually called a sink vertex.
Is it possible to detect this vertex in O(n), where n is number of vertices in graph?
As there are no cycles in the graph, and all vertex connect with the sink, just select any starting node and start walking randomly. When you can't continue walking, you are at the sink, in at most n steps.
Once you walked n steps (or less and you can't continue), as the problem does not guarantee that there is a sink, you should check if you are at one. That adds another
O(n). So the problem isO(2 n) = O(n)