Leetcode, Python, Solutions, Problem Solving, Cruio.
edges: self.adj_list[u].append((v,w)) def addEdge(self, edge: List[int]) -> None: u,v,w=edge self.adj_list[u].append((v,w)) def shortestPath(self, node1: int, node2: int) -> int: n=len(self.adj_list) pq=[(0,node1)] dist=[float('inf') for _ in range(n)] dist[node1]=0 while pq: d,u=heapq.heappop(pq)