Open In App

NTA | UGC NET 2019 December | Question 10

When using Dijkstra’s algorithm to find shortest path in a graph, which of the following statement is not true?

 



 

(A)



It can find shortest path within the same graph data structure

(B)

Every time a new node is visited, we choose the node with smallest known distance/cost (weight) to visit first

(C)

Shortest path always passes through least number of vertices

(D)

The graph needs to have a non-negative weight on every edge

Answer: (C)
Explanation:

A Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning tree. Like Prim’s MST, we generate a SPT (shortest path tree) with a given source as a root. We maintain two sets, one set contains vertices included in the shortest-path tree, other set includes vertices not yet included in the shortest-path tree. At every step of the algorithm, we find a vertex that is in the other set (set of not yet included) and has a minimum distance from the source.

In  dijkstra’s algorithm Shortest path can have any number of vertices. So that Option 3 is false.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :
Uncategorized