Dijkstra's algorithm finds the shortest path based on minimum total weight.
It does not necessarily choose the path with the least number of vertices.
A path with more vertices can have smaller total weight than a path with fewer vertices.
Dijkstra's algorithm also requires all edge weights to be non-negative.
So, the statement “Shortest path always passes through least number of vertices” is not true.
Online Test Series, Information About Examination,
Syllabus, Notification
and More.
Online Test Series, Information About Examination,
Syllabus, Notification
and More.