65 65 votes Consider the tree arcs of a BFS traversal from a source node $W$ in an unweighted, connected, undirected graph. The tree $T$ formed by the tree arcs is a data structure for computing the shortest path between every pair of vertices. the shortest path from $W$ to every vertex in the graph. the shortest paths from $W$ to only those nodes that are leaves of $T$. the longest path in the graph. Algorithms gatecse-2014-set2 algorithms graph-algorithms normal graph-search + – go_editor 18.4k views answer comment Share Follow Print See 1 comment 1 1 comment reply Siddharth_Perkar commented Jun 18 reply Follow flag Those edges jinhe hum use karte hain nodes ko explore karne ke liye, unhe hum "tree arcs" kehte hain. 1 1 replyShare Please log in or register to add a comment.
Best answer 83 83 votes BFS always has a starting node. It does not calculate shortest path between every pair but it computes shortest path between $W$ and any other vertex. Correct Answer: $B$ Digvijay Pandey answered May 10, 2015 • edited Apr 29, 2019 by Naveen Kumar 3 Digvijay Pandey comment Share Follow See all 16 Comments 16 16 Comments reply Show 13 previous comments Sidhant Kumar commented Dec 11, 2024 i edited by Sidhant Kumar Dec 11, 2024 reply Follow flag Was just looking for tree arc . Thanks 0 0 replyShare pavansan commented Jan 2, 2025 reply Follow flag got it 0 0 replyShare 𝓗𝓮𝓲𝓼𝓮𝓷𝓫𝓮𝓻𝓰 commented Dec 16, 2025 reply Follow flag @Kshitij Sharma I guess "Tree edges" and "Tree arcs" both terms are same 0 0 replyShare Please log in or register to add a comment.
15 15 votes BFS always produces shortest path from source to all other vertices in an unweighted graph. So - B Regina Phalange answered Apr 3, 2017 Regina Phalange comment Share Follow See all 3 Comments 3 3 Comments reply Kuljeet Shan commented Mar 11, 2019 reply Follow flag @Regina Phalange Any source or example ? 0 0 replyShare SURYA TEJA 1 commented Dec 17, 2019 reply Follow flag Here unweighted means all are equally weighted. 1 1 replyShare Thadymademe commented Sep 5, 2022 reply Follow flag @SURYA TEJA 1 It doesnot make any difference but you are right. 2 2 replyShare Please log in or register to add a comment.
3 3 votes Option 1: "The shortest path between every pair of vertices."Incorrect. BFS from a single source does not compute the shortest paths between every pair of vertices; that would require an all-pairs shortest path algorithm like Floyd-Warshall or repeated BFS/DFS for all nodes.Option 2: "The shortest path from W to every vertex in the graph."Correct. BFS ensures that the tree T contains the shortest path from W to every other vertex in an unweighted graph.Option 3: "The shortest paths from W to only those nodes that are leaves of T."Incorrect. BFS computes the shortest paths to all vertices, not just the leaves of the BFS tree.Option 4: "The longest path in the graph."Incorrect. BFS does not compute the longest path. Finding the longest path in a graph is a harder problem (NP-hard for general graphs). surya_siddina answered Jan 2, 2025 surya_siddina comment Share Follow 0 reply Please log in or register to add a comment.
2 2 votes Don't get confuse here between Prims algorithm and BFS. We don't have any concern of edge weights in BFS. In prims algo we take edge weights in consideration. So, if we traverse a graph using BFS we will get the shortest path from "Source" to every vertex in the graph.(here source is W). Here path means no of edges. Correct me if I'm wrong. Suraj123 answered Jul 9, 2018 Suraj123 comment Share Follow 0 reply Please log in or register to add a comment.
1 1 vote Answer is (B) Counter to option (c) Souvik33 answered Oct 17, 2022 Souvik33 comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Here we can use the concept that Idealogy of Dijkstra = BFS = PRIM'S And Dijkstra's algorithm is a Greedy Algorithm to compute shortest path from single node to all the other nodes. Hence, Answer is B. Chirag Shilwant answered Jan 23, 2020 Chirag Shilwant comment Share Follow 0 reply Please log in or register to add a comment.