Examine the following graph. We will be running Dijkstra's algorithm starting at the node labeled S S 5 1 2 A E F 9. 3 4 6 B C D 2 5 10 5 We're using the version of Dijkstra's algorithm described here in lecture: note that the fringe and distro data structures are always changed at the same time. Give the resulting edgeTo and distão maps after vertex B is visited (i.e. its outgoing edges to C and E have been relaxed). Also give the resulting edgeTo and distro maps after Dijkstra's algorithm has completely finished execution. Initialize the edgeTo for each vertex as - which will represent null for us. Initialize the distro for each vertex as inf which we'll use to represent ∞o, except for S where it should be 0. So, before the first iteration, the values of these variables are: edgeTo = {A, B, C:-, D:-, E:-, F:-, G:-, S:-} distTo = {A: inf, B:inf, C:inf, D:inf, E:inf, F:inf, G:inf, S:0} The maps must be in this order. If you have the same mappings but in a different order (i.e. the mapping for S comes first), Gradescope will say your answer is incorrect. Give edgeTo after B is visited. Format your answer as {A:?, B:?, C:?, D:?, E:?, F:?, G:?, S:-}. | (Hint: the first step of the algorithm is to visit S, which should change the entries for A and B in edgeTo and distTo. The second step is to visit B, which should change the entries for C and E)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Examine the following graph. We will be running Dijkstra's algorithm starting at the node labeled S
S
5
1
2
A
E
F
9.
3
4
6
B
C
D
2
5
10
5
We're using the version of Dijkstra's algorithm described here in lecture: note that the fringe and
distro data structures are always changed at the same time.
Give the resulting edgeTo and distão maps after vertex B is visited (i.e. its outgoing edges to C and
E have been relaxed). Also give the resulting edgeTo and distro maps after Dijkstra's algorithm has
completely finished execution. Initialize the edgeTo for each vertex as - which will represent null
for us. Initialize the distro for each vertex as inf which we'll use to represent ∞o, except for S
where it should be 0.
So, before the first iteration, the values of these variables are:
edgeTo = {A, B, C:-, D:-, E:-, F:-, G:-, S:-}
distTo = {A: inf, B:inf, C:inf, D:inf, E:inf, F:inf, G:inf, S:0}
The maps must be in this order. If you have the same mappings but in a different order (i.e. the
mapping for S comes first), Gradescope will say your answer is incorrect.
Transcribed Image Text:Examine the following graph. We will be running Dijkstra's algorithm starting at the node labeled S S 5 1 2 A E F 9. 3 4 6 B C D 2 5 10 5 We're using the version of Dijkstra's algorithm described here in lecture: note that the fringe and distro data structures are always changed at the same time. Give the resulting edgeTo and distão maps after vertex B is visited (i.e. its outgoing edges to C and E have been relaxed). Also give the resulting edgeTo and distro maps after Dijkstra's algorithm has completely finished execution. Initialize the edgeTo for each vertex as - which will represent null for us. Initialize the distro for each vertex as inf which we'll use to represent ∞o, except for S where it should be 0. So, before the first iteration, the values of these variables are: edgeTo = {A, B, C:-, D:-, E:-, F:-, G:-, S:-} distTo = {A: inf, B:inf, C:inf, D:inf, E:inf, F:inf, G:inf, S:0} The maps must be in this order. If you have the same mappings but in a different order (i.e. the mapping for S comes first), Gradescope will say your answer is incorrect.
Give edgeTo after B is visited. Format your answer as {A:?, B:?, C:?, D:?, E:?, F:?, G:?, S:-}.
|
(Hint: the first step of the algorithm is to visit S, which should change the entries for A and B in
edgeTo and distTo. The second step is to visit B, which should change the entries for C and E)
Transcribed Image Text:Give edgeTo after B is visited. Format your answer as {A:?, B:?, C:?, D:?, E:?, F:?, G:?, S:-}. | (Hint: the first step of the algorithm is to visit S, which should change the entries for A and B in edgeTo and distTo. The second step is to visit B, which should change the entries for C and E)
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education