For a weighted Directed Acyclic Graph (DAG), single-source shortest paths can be computed efficiently by processing vertices in topologically sorted order [1]:
Topologically sort the vertices of the DAG in Θ(n+m) time using Depth First Search (DFS) or Kahn's algorithm [1].
Initialize the distance to the source s as 0 and to all other vertices as ∞ in Θ(n) time [1].
Iterate through the vertices in topological order and relax all outgoing edges from each vertex [1]. Since each edge and vertex is relaxed/visited once, the total time for edge relaxation across the entire graph is Θ(m) [1].
Thus, the total worst-case running time is:
Θ(n+m)+Θ(n)+Θ(m)=Θ(m+n) Hence, (A) is the correct option [1].