In graph theory, which algorithm is used to find the shortest path from a single source vertex to all other vertices in a weighted graph with non-negative edge weights?

Answer and explanation

Correct answer: B. Dijkstra's algorithm

  1. Step 1: Identify the problem requirement: single-source shortest path with non-negative edge weights.
  2. Step 2: Dijkstra's algorithm uses a min-priority queue to greedily expand the shortest tentative distance from the source, solving in time.
Answer
Dijkstra's algorithm.
Why not the others: Kruskal's finds minimum spanning trees; Floyd-Warshall finds all-pairs shortest paths in ; DFS explores graphs without finding weighted shortest paths.

Practise more Algorithms and Python Programming.

Free questions with an explanation for every one, and full timed EmSAT Achieve (UAE) mock tests.