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

criminology

Description

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.

Instruction Files
hw5.py
10.6 KB
hw5.pdf
67.6 KB

Related Questions in criminology category