题目
题目

CS5800.18622.202610 Quiz 10

单项选择题

If Bellman-Ford's algorithm is performed on the graph with vertex set { 0 , 1 , 2 , 3 , 4 , 5 }  and adjacency matrix given below, what are the predecessors of vertices 1, 2, 3, 4 and 5 when the algorithm finishes?   Use vertex 0 as a source.  We break ties between vertices by picking the vertex with lower index.   ( 0 8 5 9 6 3 8 0 2 2 5 2 5 2 0 3 1 7 9 2 3 0 1 9 6 5 1 1 0 9 3 2 7 9 9 0 )

查看解析

查看解析

标准答案
Please login to view
思路分析
We start by restating the problem to be crystal clear: We run Bellman-Ford on a graph with vertices {0,1,2,3,4,5}, using vertex 0 as the source, and we must determine the predecessor of each of the vertices 1, 2, 3, 4, and 5 when the algorithm finishes. Tie-breaking is defined as choosing the smaller index vertex when there is a choice during relaxation. Option under consideration: The given answer choice is a single string that encodes the predecessors as follows: for vertex 1 the predecessor is 5, for vertex 2 the predecessor is 0, for vertex 3 the predecessor is 4, for vertex 4 the predecessor is 0, and for vertex 5 the predecessor is 0. In other words, P(1)=5, P(2)=0, P(3)=4, P(4)=0, P(5)=0. To reason about correctness, we examine what the final predecessor array represents in Bellman-Ford. Each vertex v≠source 0 has a predecessor p(v) such that the path from 0 to v following p(v) edges reaches v with the minimum possible total weight found after |V|-1 relaxations. In cas......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!