Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the directed graph shown in the figu... Start Learning for Free
Consider the directed graph shown in the figure below. There are multiple shortest paths between
vertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, in
any iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v is
discovered.
  • a)
    SDT
  • b)
    SBDT
  • c)
    SACDT
  • d)
    SACET
Correct answer is option 'D'. Can you explain this answer?
Verified Answer
Consider the directed graph shown in the figure below. There are multi...
Let d[v] represent the shortest path distance computed from ‘S’
Initially d[S]=0, d[A] = ∞, d[B] = ∞.− − − −,d[T] = ∞
And let P[v] represent the predecessor of v in the shortest path from ‘S’ to ‘v’ and let P[v]=-1
denote that currently predecessor of ‘v’ has not been computed
→ Let Q be the set of vertices for which shortest path distance has not been computed
→ Let W be the set of vertices for which shortest path distance has not been computed
→ So initially, Q = {S,A,B,C,D,E,F,G,T},W = f
We will use the following procedure
Repeat until Q is empty
{
1 u = choose a vertex from Q with minimum d[u] value
2. Q = Q − u
3. update all the adjacent vertices of u
4. W = W U{u}
}
d[S] = 0, d[A] = ∞, d[B] = ∞ ,………, d[T] = ∞
Step 1 : u = S
Step 2 : Q ={A,B,C,D,E,F,G,T}
Step 3: final values after adjustment
d[S] = 0,d[A] = 4, d[B] = 3,d[C] = ∞,d[D] = 7,d[E] = ∞ − −−,d[T] = ∞
P[A] = S, P[B] = S,P[C] = −1,P[D] = S,P[E] = −1− −−,P[T] = −1
Step 4 : W={S}
Iteration 2:
Step 1: u= B
Step 2 :Q ={A,C,D,E,F,G,T}
step 3: final values after adjustment
d[S] = 0,d[A] = 4, d[B] = 3,d[C] = ∞,d[D] = 7,d[E] = ∞ − −−,d[T] = ∞
P[A] = S, P[B] = S,P[C] = −1,P[D] = S,P[E] = −1− −−,P[T] = −1
Step 4 : W={S,B}
Iteration 3:
Step 1: u= A
Step 2 :Q ={C,D,E,F,G,T}
step 3: final values after adjustment
d[S] = 0,d[A] = 4, d[B] = 3,d[C] = 5,d[D] = 7,d[E] = ∞ − −−,d[T] = ∞
P[A] = S, P[B] = S,P[C] = A,P[D] = S,P[E] = −1− −−,P[T] = −1
Step 4 : W={S,B,A}
Iteration 4:
Step 1: u= A
Step 2 :Q ={D,E,F,G,T}
step 3: final values after adjustment
d[S] = 0,d[A] = 4, d[B] = 3,d[C] = 5,d[D] = 7,d[E] = 6 − −−,d[T] = ∞
P[A] = S, P[B] = S,P[C] = A,P[D] = S,P[E] = −1− −−,P[T] = −1
Step 4 : W={S,B,A,C}
Iteration 5:
Step 1: u= E
Step 2 :Q ={D,F,G,T}
step 3: final values after adjustment
d[S] = 0,d[A] = 4, d[B] = 3,d[C] = 5,d[D] = 7,d[E] = 6,d[F] = ∞,d[G] = 8,d[T] = 10
P[A] = S, P[B] = S,P[C] = A,,P[D] = S,P[E] =C, P[F]= −1, P[G]=E, P[T] = E
Step 4 : W={S,B,A,C,E}
After iteration 5, we can observe that P[T]=E , P[E]=C , P[C]=A , P[A]=S,
So the shortest path from S to T is SACET
View all questions of this test
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer?
Question Description
Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer?.
Solutions for Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer?, a detailed solution for Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? has been provided alongside types of Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the directed graph shown in the figure below. There are multiple shortest paths betweenvertices S and T. Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, inany iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v isdiscovered.a)SDTb)SBDTc)SACDTd)SACETCorrect answer is option 'D'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev