3 3 votes Consider an undirected, weighted graph G with positive weights. Let a breadth-first traversal of G be done starting from a node r.Let $d(r, u), d(r, v)$ represent the length of the shortest path from $r$ to $u, v$ respectively.If u is visited before v during the traversal, which of the following must hold?$d(r, u)<d(r, v)$ $d(r, u) \leq d(r, v)$ $d(r, u) \geq d(r, v)$ None of the above Algorithms goclasses algorithms goclasses-cs-dpp goclasses-cs-dpp-day-75 goclasses-algorithms-practice-questions + – GO Classes 466 views answer comment Share Follow Print See all 3 Comments 3 3 Comments reply amanbadone0 commented Jan 8 reply Follow flag If the graph was unweighted, Here 0 0 replyShare Prince_Garg commented Jan 17 reply Follow flag @Sachin Mittal 1 Sir, could you please check which option is most suitable as the answer?According to me, Option: B stands out. If we assume that the weights are just describing the levels,it seems more appropriate. Previously, I don’t remember seeing this as a PYQ or a standard problem.Could you please enlighten us on which option appears to be correct? 0 0 replyShare Vedanth_Upadhyaya commented May 27 reply Follow flag if weights mean levels/no of edges then b is the answer,but if weights is mentioned as a trap,then answer becomes d. This question seems to be a bit ambiguous 0 0 replyShare Please log in or register to add a comment.
0 0 votes answer is D becuse it weighted graph but if weights are contant then B and c is correct deppend on which node visited first is correct. Gaurav_sharma 1 answered Sep 4, 2025 Gaurav_sharma 1 comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes BFS ignores weight, it only minimizes the number of edges not the sum of weight. Hence $(D)$Either u is in a lower BFS level than v, oru and v are in the same BFS level but u was dequed earlierOne more point, its BFS thus can't use Parenthesis Theorem, cause if the same question was for DFS then it can be easily solved by Parenthesis Theorem. amanbadone0 answered Jan 7 amanbadone0 comment Share Follow 0 reply Please log in or register to add a comment.