A weighted directed graph has 3 vertices with the following edges: (1→2, weight 2), (2→1, weight −3), (2→3, weight 1). After running Floyd-Warshall, what is the value of D[1][1]?
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
A weighted directed graph has 3 vertices with the following edges: (1→2, weight 2), (2→1, weight −3), (2→3, weight 1). After running Floyd-Warshall, what is the value of D[1][1]?
Which of the following properties hold true for the Bellman-Ford algorithm when applied to a graph with a negative weight cycle reachable from the source?
Consider a graph where Bellman-Ford algorithm is applied. After the V-1 iterations, an additional iteration still relaxes at least one edge. What can be concluded?
The time complexity of Dijkstra's algorithm using a binary min-heap (priority queue) on a graph with V vertices and E edges is:
Dijkstra's algorithm processes each vertex exactly once and each edge at most once. Which of the following correctly states the number of relaxation operations performed in the worst case for a graph with V vertices and E edges?
Dijkstra's algorithm with a binary min-heap is run on a sparse graph with V vertices and E = O(V) edges. What is the time complexity?
A network of distributed data processing units (servers) S, A, B, C, D, E. Edges represent direct data transfer pathways, and the associated weights are the latency in milliseconds for data transfer. Dijkstra's algorithm is employed to find the minimum latency path from the source unit S to all other units.
The current state of the algorithm is as follows: server A has just been extracted from the priority queue and its neighbors processed. The tentative shortest latencies (dist) are: dist[S]=0, dist[A]=3, dist[B]=4, dist[C]=8, with dist[D]=dist[E]=infinity. The set of visited servers is {S, A}. The priority queue (PQ) contains {(4, B), (8, C)}, where elements are (latency, server_ID).
The complete network connections and their respective latencies are:
S-A: 3ms
S-B: 7ms
A-B: 1ms
A-C: 5ms
B-C: 2ms
B-D: 6ms
C-D: 1ms
D-E: 4ms
What will be the state of the priority queue and the tentative distances immediately after the next server is extracted from the priority queue and all its unvisited neighbors have been processed?
A graph G has 6 vertices and the following weighted adjacency matrix (∞ means no direct edge). Source vertex = 1. After running Dijkstra's algorithm, the shortest distance from vertex 1 to vertex 6 is 11. How many edges are on the shortest path from vertex 1 to vertex 6 if the path is unique?
Consider an undirected weighted graph G where Dijkstra's algorithm from source s produces the shortest path tree T. Which of the following are always true about T?
Consider running Dijkstra's algorithm on a graph with 5 vertices {1,2,3,4,5} and edges: (1,2,10), (1,3,3), (3,2,4), (3,4,8), (2,4,1), (4,5,7), (2,5,2). Source = vertex 1. What is the order in which vertices are finalized (added to set S)?
Bellman-Ford is based on which paradigm?
The transitive closure of a directed graph can be computed using a variant of Floyd-Warshall. The recurrence for transitive closure uses boolean operations. What is the correct recurrence?
Consider a directed weighted graph G. Dijkstra's algorithm is executed from source s. During execution, when vertex u is extracted from the priority queue, it is guaranteed that d[u] is the true shortest distance. This guarantee breaks if:
In Bellman-Ford, what happens if no relaxation occurs in an iteration before V-1?
Dijkstra's algorithm is run on a graph G. The number of times the decrease-key operation is performed in the worst case using a binary min-heap is:
A directed graph G has n vertices and a negative weight cycle. If Floyd-Warshall is run on G, which of the following outcomes are possible?
Which algorithm is preferred over Bellman-Ford when all edge weights are non-negative?
The predecessor matrix π is used in Floyd-Warshall for path reconstruction. Initially π^(0)[i][j] = i if edge (i,j) exists, else NIL. After the k-th iteration, π^(k)[i][j] is updated to:
After k iterations of Bellman-Ford, shortest paths with how many edges are guaranteed?
If a graph has V vertices, what is maximum number of relaxations per edge?
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 →