The solution would be computing the out-degrees of all vertices to see if there is one single sink vertex (a vertex with 0 out-degree), here is the proof.
Statement: A DAG has a vertex that is reachable from every other vertex if and only if there is one single vertex with 0 out-degrees.
This statement can be proven in two steps.
Proof of necessity: If a DAG contains a vertex u that is reachable from every other vertex, it must be the only sink vertex (a vertex with 0 out-degree)
- u have 0 out-degree, otherwise cycle forms, contradicting DAG.
- There can't be another sink vertex v with 0 out-degree, otherwise u is not reachable from v
Proved.
Proof of sufficiency: If a DAG contains one single sink vertex u, then u should be reachable from every other vertex.
Assume there exist vertices in the DAG that can't reach u. Let's divide all vertices in the DAG into the set of vertices that can reach u ($V_y$), and those cannot reach u ($V_n$), then there do not exist any edges from vertices in $V_n$ pointing to vertices in $V_y$.
Lemma: Any DAG must contain at least one sink vertices.
This is easy to prove by contradiction. Assume every vertex in the DAG has non-zero out-degrees, so starting from one vertex, we can keep traversing along the out-going edges of each vertex. Since DAG contains a finite number of vertices, we will return to a previously visited vertex eventually, i.e. cycle is detected, contradicting DAG definition.
Consider the graph formed by vertices in $V_n$ and edges between them, it must also be a DAG, otherwise, the original graph cannot be a DAG. Suppose v is a sink vertex in this sub-DAG, so v doesn't have any outgoing edge pointing to vertices in $V_n$.
As mentioned above, there can't be any edges from v pointing to any vertex in $V_y$ either, otherwise, v can reach u.
So the overall out-degrees of v in the original DAG is also 0, contradicting the assumption that the DAG contains a single sink vertex. Proved.