Question: Weekly Problems - > Week 1 0 : Shortest Path This problem builds on top of our previous problem where we completed Dijkstra's algorithm for

Weekly Problems -> Week 10: Shortest Path
This problem builds on top of our previous problem where we completed Dijkstra's algorithm for the graph below given vertex A as the source.
Recall that the vertexSet represents the graph:public class FHgraph
{// the graph data is all here --------------------------
protected HashSet FHvertex > vertexSet;
// public graph methods --------------------------------
public boolean dijkstra(E x){....}
public boolean showDistancesTo(E x){....}
public boolean showShortestPath(E x1, E x2){....}
Below is a reminder of the attributes in the FHvertex class:
After completing Dijkstra's algorithm from source A, the dist and nextInPath attributes of a reachable FHvertex are set.
class FHvertex
{
// omitted class variables
// attributes --------------------------
public HashSet Pair > adjList
= new HashSet Pair >();
public E data;
public double dist;
public FHvertex nextInPath; // for client-specific info
Problem 1
What is the output of showDistancesTo(E x) method?
Note: display your response similar to the previous problem.
Problem 2
Choose three FHvertex objects.
What is the output of showShortestPath(A, youVertextChoice) for each?
For problem 1 show a visual representation of the partiallyProcessedVerts for every iteration of the while loop in dijkstra() method.
The attributes dist and cost for every vertex.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!