GATE CS 2026 · Set-2 · Graph Traversals (BFS & DFS)

MCQ · 2 marks · Problem PROG-GRPH-0034

Let \(G\) be a weighted directed acyclic graph with \(m\) edges and \(n\) vertices. Given \(G\) and a source vertex \(s\) in \(G\), which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from \(s\) to all vertices that are reachable from \(s\) in \({G}?\)
  1. A
    \(\Theta(m+n)\)
  2. B
    \(\Theta(m+n \log (n))\)
  3. C
    \(\Theta(n m)\)
  4. D
    \(\Theta\left(n^{3}\right)\)

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option A.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/523119/gate-cse-2026-set-2-question-27

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com