单选题 若要求在找到从S到其他顶点最短路的同时,还给出不同的最短路的条数,我们可以将Dijkstra算法略作修改,增加一个count[]数组:count[V]记录S到顶点V的最短路径有多少条。则count[V]应该被初始化为:

A、 count[S]=1; 对于其他顶点V则令count[V]=0
B、 count[S]=0; 对于其他顶点V则令count[V]=1
C、 对所有顶点都有count[V]=1
D、 对所有顶点都有count[V]=0
下载APP答题
由4l***1f提供 分享 举报 纠错

相关试题

单选题 In a weighted graph, if the length of the shortest path from b to a is 10, and there exists an edge of weight 3 between c and
B, then how many of the following statements is/are TRUE?
The length of the shortest path from c to a must be 13.
The length of the shortest path from c to a must be 7.
The length of the shortest path from c to a must be no greater than 13.
The length of the shortest path from c to a must be no less than 7.

A、1
B、2
C、3
D、4

单选题 设图中顶点总数为n,求解任意两个顶点之间的最短路径的Floyd算法的时间复杂度为( )

A、O(n³)
B、O(n²)
C、O(n)
D、O(1)

判断题 Let P be the shortest path from S to T. If the weight of every edge in the graph is incremented by 1, P will still be the shortest path from S to T.
正确
错误

A、正确
B、错误

单选题 Dijkstra's Algorithm cannot be applied on ______________

A、Directed and weighted graphs
B、Graphs having negative weight function
C、Unweighted graphs
D、Undirected and unweighted graphs

单选题 Dijkstra算法 2.Prim算法 3.Floyd算法 4.Kruskal算法

A、1
B、2
C、3
D、4

单选题 Which of the following statements is FALSE about the shortest path algorithms?

A、Dijkstra's algorithm works out the shortest path in increasing order of distances.
B、Single-source algorithms work fast on sparse graphs when finding the shortest path between any pair of vertices.
C、Negative-cost edge in a directed graph will cause infinite loop in Dijkstra's algorithm.
D、BFS can work out the shortest path when costs of all the edges are positive and equal.

单选题 Dijkstra算法是____方法求出图中从某顶点到其余顶点的最短路径的。

A、按长度递减的顺序求出图中某顶点到其余顶点的最短路径
B、按长度递增的顺序求出图中某顶点到其余顶点的最短路径
C、通过深度优先遍历求出图中某顶点到其余顶点的最短路径
D、通过广度优先遍历求出图中某顶点到其余顶点的最短路径

判断题 P 是顶点 S 到 T 的最短路径,如果该图中的所有路径的权值都加 1,P 仍然是 S 到 T 的最短路径。
正确
错误

A、正确
B、错误