Simple Python solution using Djikstra's
BFS is used to iterate through the nodes, where next node is determined using priority queue ordered by its distance from starting node K.\n\n    def networkDel
BFS is used to iterate through the nodes, where next node is determined using priority queue ordered by its distance from starting node K.\n```\n    def networkDelayTime(self, times, N, K):\n        pq = []\n        adj = [[] for _ in range(N+1)]\n        for time in times:\n            adj[time[0]].append((time[1], time[2]))\n\n        fin, res = set(), 0\n        heapq.heappush(pq, (0, K))\n\n        while len(pq) and len(fin) != N:\n            cur = heapq.heappop(pq)\n            fin.add(cur[1])\n            res = cur[0]\n            for child, t in adj[cur[1]]:\n                if child in fin: continue\n                heapq.heappush(pq, (t+cur[0], child))\n\n        return res if len(fin) == N else -1\n```
[]