Detecting single source shortest paths in a weighted graph with negative weights
Detecting all pairs shortest paths in a weighted graph with negative weights
Detecting single source shortest paths in undirected graph without negative weights
Detecting all pairs shortest paths in a weighted graph without negative weights
Show Solution
Verified By Collegedunia
The Correct Option isA
Solution and Explanation
Concept:
Bellman-Ford is a shortest path algorithm that computes the shortest distance from a single source vertex to all other vertices.
Unlike Dijkstra's algorithm, Bellman-Ford can handle graphs containing negative edge weights.
It can also detect negative weight cycles.
Step 1: Recall the purpose of Bellman-Ford.
Given a source vertex \(s\),
Bellman-Ford computes:
\[
d(s,v)
\]
for every vertex \(v\).
Thus it is a single-source shortest path algorithm.
Step 2: Identify its major advantage.
Bellman-Ford works correctly even when some edge weights are negative.
For example,
\[
A \rightarrow B=-5
\]
can be processed successfully.
Step 3: Compare with other algorithms.
Dijkstra's algorithm fails for graphs with negative edge weights.
Floyd-Warshall computes all-pairs shortest paths.
Therefore Bellman-Ford is uniquely associated with single-source shortest paths and negative weights.
Step 4: Write the answer.
Hence Bellman-Ford is used for
\[
\boxed{\text{Single Source Shortest Paths with Negative Weights}}.
\]
Therefore option (A) is correct.
Was this answer helpful?
0
0
Top TS PGECET Computer Science & Information Technology Questions