import Graph from collections import defaultdict from heapq import heappush, heappop import math def dijkstra(adjacency_list, source, target): """ To be implemented by students. `adjacency_list` is a dictionary with values: (vertice, weight). Function should return (distance, path). Path should be a list of the vertices in the shortest path **including** the source and target. If no shortest path is found, it should return (infinity, []) """ return math.inf, [source] if __name__ == '__main__': try: Graph.test_dijkstra(dijkstra) print('Passed ALL tests!') except AssertionError: print('Failed one or more tests')