Simple JAVA Djikstra's (PriorityQueue optimized) Solution with explanation
It is a direct graph. \n1. Use Map> to store the source node, target node and the distance between them.\n2. Offer the node K to a PriorityQueue.\n3. Then keep 
It is a direct graph. \n1. Use Map<Integer, Map<Integer, Integer>> to store the source node, target node and the distance between them.\n2. Offer the node K to a PriorityQueue.\n3. Then keep getting the closest nodes to the current node and calculate the distance from the source (K) to this node (absolute distance). Use a Map to store the shortest absolute distance of each node.\n4. Return the node with the largest absolute distance.\n\n```\npublic int networkDelayTime(int[][] times, int N, int K) {\n        if(times == null || times.length == 0){\n            return -1;\n        }\n        // store the source node as key. The value is another map of the neighbor nodes and distance.\n        Map<Integer, Map<Integer, Integer>> path = new HashMap<>();\n        for(int[] time : times){\n            Map<Integer, Integer> sourceMap = path.get(time[0]);\n            if(sourceMap == null){\n                sourceMap = new HashMap<>();\n                path.put(time[0], sourceMap);\n            }\n            Integer dis = sourceMap.get(time[1]);\n            if(dis == null || dis > time[2]){\n                sourceMap.put(time[1], time[2]);\n            }\n            \n        }\n\n        //Use PriorityQueue to get the node with shortest absolute distance \n        //and calculate the absolute distance of its neighbor nodes.\n        Map<Integer, Integer> distanceMap = new HashMap<>();\n        distanceMap.put(K, 0);\n        PriorityQueue<int[]> pq = new PriorityQueue<>((i1, i2) -> {return i1[1] - i2[1];});\n        pq.offer(new int[]{K, 0});\n        int max = -1;\n        while(!pq.isEmpty()){\n            int[] cur = pq.poll();\n            int node = cur[0];\n            int distance = cur[1];\n\n            // Ignore processed nodes\n            if(distanceMap.containsKey(node) && distanceMap.get(node) < distance){\n                continue;\n            }\n            \n            Map<Integer, Integer> sourceMap = path.get(node);\n            if(sourceMap == null){\n                continue;\n            }\n            for(Map.Entry<Integer, Integer> entry : sourceMap.entrySet()){\n                int absoluteDistence = distance + entry.getValue();\n                int targetNode = entry.getKey();\n                if(distanceMap.containsKey(targetNode) && distanceMap.get(targetNode) <= absoluteDistence){\n                    continue;\n                }\n                distanceMap.put(targetNode, absoluteDistence);\n                pq.offer(new int[]{targetNode, absoluteDistence});\n            }\n        }\n        // get the largest absolute distance.\n        for(int val : distanceMap.values()){\n            if(val > max){\n                max = val;\n            }\n        }\n        return distanceMap.size() == N ? max : -1;\n}\n```
[]