The Floyd-Warshall algorithm computes shortest paths between all pairs of vertices in a weighted directed graph. Which of the following best describes the algorithmic paradigm used by Floyd-Warshall?
GATE CSE · Algorithms
Master topic for Shortest Path. Includes Dijkstra's Algorithm, Bellman-Ford Algorithm, Floyd-Warshall Algorithm.
103 questions · 0 PYQs · 20 AI practice · GATE CSE 2027
The Floyd-Warshall algorithm computes shortest paths between all pairs of vertices in a weighted directed graph. Which of the following best describes the algorithmic paradigm used by Floyd-Warshall?
A directed graph G has 4 vertices. The weight matrix is:
W = [[0,1,∞,∞],[∞,0,1,∞],[∞,∞,0,1],[1,∞,∞,0]]
After running Floyd-Warshall, what is the value of D[1][3]?
For which of the following graph types is Floyd-Warshall particularly more suitable than running Dijkstra from each source?
In which of the following scenarios does Dijkstra's algorithm fail to give correct shortest paths?
Dijkstra's algorithm cannot handle graphs with ______.
Which of the following conditions indicates a negative cycle?
Which of the following is the correct order of time complexities of Dijkstra's algorithm from fastest to slowest, based on the data structure used for the priority queue?
Which statements are correct regarding Bellman-Ford?
Consider a directed graph with V vertices and E edges that may contain negative edge weights but no negative weight cycle. Which of the following statements about the Bellman-Ford algorithm is correct?
The recurrence relation of Floyd-Warshall is D^(k)[i][j] = min(D^(k-1)[i][j], D^(k-1)[i][k] + D^(k-1)[k][j]). Why is it safe to perform this update in-place (i.e., overwriting D[i][j] without maintaining a separate D^(k-1) array)?
In Dijkstra's algorithm, relaxation of an edge (u, v) with weight w(u,v) is performed. The relaxation condition is:
Consider a graph with V vertices where all edge weights are 1. Which algorithm would find single-source shortest paths more efficiently than Dijkstra's algorithm?
What is the time complexity of Dijkstra's algorithm using a binary heap?
A graph G has V vertices and E edges with non-negative weights. Dijkstra's algorithm is implemented using a Fibonacci heap. What is the time complexity?
The Floyd-Warshall algorithm is used to find the transitive closure of a directed graph with n vertices. The time complexity of this transitive closure computation is:
Compare Floyd-Warshall with running Dijkstra's algorithm from every vertex. For a dense graph with n vertices and E ≈ n² edges, which approach is more efficient?
Dijkstra's algorithm fails when the graph contains ______.
Consider a network of financial analysts, where nodes represent analysts (A, B, C, D, E) and edges represent communication channels with associated 'trust latency' (in hours). This latency acts as the weight, representing the time required for information to be fully processed and accepted. Dijkstra's algorithm is applied to find the minimum total trust latency from source analyst A to all other analysts. The network and its trust latencies are given as: A-B (2 hours), A-C (7 hours), B-C (3 hours), B-D (4 hours), C-D (1 hour), D-E (5 hours).
Suppose Dijkstra's algorithm has reached a state where node B has just been extracted from the priority queue and marked as visited. At this specific point, the tentative shortest distances are: dist[A]=0, dist[B]=2, dist[C]=5, dist[D]=6, dist[E]=infinity. The set of visited nodes is {A, B}, and the priority queue contains {(5, C), (6, D)} (where elements are (latency, node)).
What will be the state of the priority queue and the tentative distances immediately after the next node is extracted from the priority queue and all its unvisited neighbors have been processed?
Consider a directed graph G with n vertices. The Floyd-Warshall algorithm is run on G. What is its time complexity?
Consider a weighted undirected graph with vertices {A, B, C, D} and edges: A-B (weight 1), A-C (weight 4), B-C (weight 2), B-D (weight 5), C-D (weight 1). Dijkstra's algorithm is run from source A. What is the shortest distance from A to D?
Want unlimited AI-generated Shortest Path questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →