Question: I am providing you with the source code to Dijkstras, Graph.java. The source code can be found in the files section of canvas, in a

I am providing you with the source code to Dijkstras, Graph.java. The
source code can be found in the files section of canvas, in a folder
named HW6. Please modify the skeleton code to solve the following
tasks.
1. Implement the dijkstras(int s) function as we reviewed in class.
a. Hint: We use an adjacency matrix to represent the graph. If
A[i][j]=0, it means there is no edge between the i-th and
j-th node. If A[i][j] does not =0, then it means the weight of
the edge between the i-th and j-th node.
b. Hint: Please use Set S = new HashSet<>
And PriorityQueue Q = new
PriorityQueue<>(Comparator.comparingInt(u -> d[u]));
For the set S and the PriorityQueue Q.
c. Hint: For the rest of the functions needed to utilize the
priority queue in the Dijkstras algorithm, please google
Java PriorityQueue API, and find some tutorials to better
understand it.
Submission:
1. Work individually
2. Submit all codes and report as a last_name.zip file
3. Submit on time, a late submission will receive a penalty of a lowered
letter grade for each day it's late. After three days it's zero.

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 Finance Questions!