Questions: Shortest Paths in Unweighted Graphs

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A weighted graph has two paths from vertex A to vertex B: one with 2 edges (total weight 100) and one with 5 edges (total weight 3). If you run BFS from A, which path does it find, and is this the shortest path?

ABFS finds the 2-edge path; this is the shortest path by weight
BBFS finds the 2-edge path because it minimizes edge count; this is NOT the shortest-weight path
CBFS finds the 5-edge path because it has lower total weight
DBFS cannot be applied to weighted graphs at all
Question 2 Multiple Choice

In an unweighted graph, BFS visits vertex V for the first time after processing 12 other vertices. What can you conclude about V's shortest-path distance from the source?

ANothing — BFS visiting order depends on the graph's adjacency list order, not distance
BThe distance is at most 12, but BFS does not guarantee it finds the shortest path on first visit
CThe distance equals the BFS level at which V was first discovered, and this IS the shortest-path distance
DThe distance is exactly 12, since V was the 12th vertex processed
Question 3 True / False

In an unweighted graph, the first time BFS reaches a vertex is always via a shortest path from the source.

TTrue
FFalse
Question 4 True / False

Running BFS from a source vertex and recording parent pointers produces a unique shortest-path tree.

TTrue
FFalse
Question 5 Short Answer

Why does BFS correctly find shortest paths in unweighted graphs, and why does the same approach fail for weighted graphs?

Think about your answer, then reveal below.