Graph Algorithms


Answer & solution
Answer: B (no official key was published)
1. With only weights 0 and 1, a finite path has total cost 0 precisely when all of its edges belong to E1.
2. Hence d(v1,v)=0 precisely for vertices in the G1 component of v1. Test this for every v∈V1: all distances zero means G1 is connected; any positive/infinite distance means it is not.
3. Cost does not count zero-weight edges. A zero-weight chain and a zero-weight clique on V1 can give identical distance-zero results but different edge counts and cycle structure.
4. Thus the distances determine connectivity (B), but neither clique/tree status nor shortest-path edge counts.
Solution: An edge has weight zero exactly when it belongs to E1. Consequently, for a vertex v in V1, distance(v1,v)=0 exactly when v is connected to v1 using only edges of G1. Checking whether every vertex of V1 has zero distance therefore decides whether G1 is connected, B. Zero distances do not reveal edge counts, clique structure, or acyclicity: a tree and a triangle within the reachable zero-weight component can have identical distances. B must be read as determining connectivity, not asserting that every possible input G1 is connected.