Several algorithms find the shortest path in a graph, including Dijkstra's algorithm for non-negative edge weights, which finds paths from a single source to all other nodes, and the Bellman-Ford algorithm, which handles negative edge weights. For all-pairs shortest paths, the Floyd-Warshall algorithm computes shortest paths between all pairs of vertices, while Johnson's algorithm also handles negative weights and is efficient for sparse graphs.
Which algorithm is used to find the shortest path in a graph?
Review the verified answer and explanation for this SPSC – Sindh Public Service Commission past-paper question on CampusFin.
Question context
This question is part of 💻 Computing within the broader 💾 Computer Science subject and appears in the SPSC – Sindh Public Service Commission preparation collection. Reviewing the answer together with nearby questions helps reinforce the underlying concept and identify how it may appear in competitive exams.