private void dijkstra(int source, int[] dist, HashMap<Integer, HashMap<Integer, Integer>> g){
		dist[source]=0;
		PriorityQueue<NodeWithDist> q = new PriorityQueue<NodeWithDist>();
		q.add(new NodeWithDist(source, dist[source]));
		while(!q.isEmpty()){
			int node = q.poll().node;
			for(int neighbor:g.get(node).keySet()){
				if(dist[node] + g.get(node).get(neighbor) < dist[neighbor]){
					dist[neighbor] = dist[node] + g.get(node).get(neighbor);
					q.add(new NodeWithDist(neighbor, dist[neighbor]));
				}
			}
		}
	}