Based on what we have learned about Dijkstra’s algorithm in class, we build on its logic and include more functionality.

computer science

Description

Please answer the following questions. Submit your question1.py file on Gradescope 

Q1. Based on what we have learned about Dijkstra’s algorithm in class, we build on its logic and include more functionality. 

Note: For this assignment, we provided you with HeapPriorityQueue, Vertex, DijkstraGraph classes in the question1.py file.


Warning: DO NOT use pythonds or any other library function/module to implement PriorityQueue, Vertex, and Graph.

 

1. (90 points) In the DijkstraGraph class fill setDistance(), setPred(), dijkstra() functions as specified in the comments, to implement Dijkstra’s algorithm successfully so that the shortest paths and the predecessor nodes (nodes in the path) are determined. 


2. (10 points) In the DijkstraGraph class fill betweenness_func() to get the node with the highest Betweenness. Betweenness centrality is the number of times a node is a predecessor in shortest paths for all start points. I.e. for i in {‘V0’,’V1’,...,'Vn’}: dijkstra(start = i) Check function description for more details and clarity.



Related Questions in computer science category