Let G(V,E) be an undirected graph with positive edge weights. Dijkstra's single source shortest path algorithm can be implemented using the binary heap data structure with time complexity:
GATE CSE · Algorithms
Master topic for Shortest Path. Includes Dijkstra's Algorithm, Bellman-Ford Algorithm, Floyd-Warshall Algorithm.
103 questions · 6 PYQs · 14 AI practice · GATE CSE 2027
Let G(V,E) be an undirected graph with positive edge weights. Dijkstra's single source shortest path algorithm can be implemented using the binary heap data structure with time complexity:
Let s and t be two vertices in a undirected graph G=(V, E) having distinct positive edge weights. Let [X, Y] be a partition of V such that s X and t Y. Consider the edge e having the minimum weight amongst all those edges that have one vertex in X and one vertex in Y. Let the weight of an edge e denote the congestion on that edge. The congestion on a path is defined to be the maximum of the congestions on the edges of the path. We wish to find the path from s to t having minimum congestion. Which one of the following paths is always such a path of minimum congestion?
Let be a directed graph whose vertex set is the set of numbers from 1 to 100. There is an edge from a vertex to a vertex iff either or . The minimum number of edges in a path in G from vertex 1 to vertex 100 is
Suppose we run Dijkstra's single source shortest-path algorithm on the following edge-weighted directed graph with vertex P as the source. In what order do the nodes get included into the set of vertices for which the shortest path distances are finalized?

Let G = (V,E) be an undirected graph with a sub-graph G1 = (V1,E1), Weight are assigned to edges of G as follows
A single-source shortest path algorithm is executed on the weighted graph (V,E,w) with an arbitrary vertex v1 of V1 as the source. Which of the following can always be inferred from the path costs computed?
Consider the undirected unweighted graph G. Let a breadth-first traversal of G be done starting from a node r . Let d(r,u) and d(r,v) be the lengths of the shortest paths form r to u and v respectively in G. If u is visited before v during the breadth-first traversal, which of the following statements is correct ?
In a space traffic control system, stations monitor cosmic dust. Each station (Alpha, Beta, Gamma, Delta, Epsilon) processes data with a certain delay (in microseconds) when transmitting to an adjacent station. Dijkstra's algorithm is applied to find the minimum cumulative data processing delay from the source station Alpha to all other stations.
The network connections and their processing delays are:
Alpha-Beta: 4 µs
Alpha-Gamma: 9 µs
Beta-Gamma: 2 µs
Beta-Delta: 7 µs
Gamma-Delta: 1 µs
Gamma-Epsilon: 10 µs
Delta-Epsilon: 3 µs
At an intermediate stage, the tentative shortest processing delays (dist) from Alpha are:
dist[Alpha]=0, dist[Beta]=4, dist[Gamma]=6, dist[Delta]=11, dist[Epsilon]=infinity.
The set of visited stations is {Alpha, Beta}.
The priority queue (min-heap, storing (delay, station_ID)) contains {(6, Gamma), (11, Delta)}.
What will be the state of the priority queue and the tentative distances immediately after station Gamma is extracted from the priority queue and all its unvisited neighbors have been processed?
Suppose Dijkstra's algorithm is simulating the propagation of a synthetic neurotransmitter in a simplified neural network model. Nodes represent neurons (N1, N2, N3, N4, N5), and edges represent synapses with 'signal degradation' as weights. We aim to find the path with minimum total signal degradation from the source neuron N1 to all other neurons.
At an intermediate stage, neuron N2 has just been extracted from the priority queue and marked as visited. The tentative shortest signal degradations (dist) from N1 are: dist[N1]=0, dist[N2]=2, dist[N3]=5, dist[N4]=7, dist[N5]=infinity. The set of visited neurons is {N1, N2}. The priority queue (min-heap storing (degradation, neuron)) contains {(5, N3), (7, N4)}.
The complete network connections and their signal degradation values are:
N1-N2: 2 units
N1-N3: 7 units
N2-N3: 3 units
N2-N4: 5 units
N3-N4: 1 unit
N3-N5: 8 units
N4-N5: 2 units
What will be the state of the priority queue and the tentative distances immediately after the next neuron is extracted from the priority queue and all its unvisited neighbors have been processed?
Floyd-Warshall is applied to a graph G to compute all-pairs shortest paths. Which of the following statements correctly distinguishes Floyd-Warshall from the Bellman-Ford algorithm?
Which of the following modifications to Dijkstra's algorithm would correctly handle graphs with negative edge weights (but no negative cycles)?
Dijkstra's algorithm is used to find the shortest path from a source vertex to all other vertices in a weighted graph. Which of the following is a necessary condition for Dijkstra's algorithm to produce correct results?
Which of the following are true about Bellman-Ford algorithm?
In Bellman-Ford algorithm, why are all edges relaxed V-1 times?
A graph has 5 vertices. The Bellman-Ford algorithm is run from a source vertex. What is the maximum number of edge relaxation iterations required to guarantee correct shortest paths (assuming no negative cycles)?
In Dijkstra's algorithm, which data structure gives the best asymptotic time complexity for a dense graph with V vertices and E edges?
Dijkstra's algorithm maintains a set S of vertices whose final shortest distances are determined. At each step, it picks the vertex u not in S with minimum distance estimate d[u] and adds it to S. This greedy choice is correct because:
Consider a weighted directed graph where Dijkstra's algorithm is run from source s. After the algorithm completes, the predecessor array π[] defines the shortest path tree. Which of the following properties hold for this shortest path tree?
Consider a 3-vertex graph with edges: (1→2, weight −1), (2→3, weight −2), (3→1, weight 4). Does this graph contain a negative weight cycle, and what is D[1][1] after Floyd-Warshall?
Consider Floyd-Warshall on a graph with 4 vertices. The initial distance matrix (∞ denotes no edge) is:
[[0,∞,−2,∞],[4,0,3,∞],[∞,∞,0,2],[∞,−1,∞,0]]
What is D[1][4] after all iterations of Floyd-Warshall?
Floyd-Warshall algorithm can detect negative weight cycles in a directed graph. What is the condition to detect a negative weight cycle after the algorithm completes?
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 →