private void relax(DirectedEdge e) {
        int v = e.from(), w = e.to();
        if (distTo[w] > distTo[v] + e.weight()) {
            distTo[w] = distTo[v] + e.weight();
            edgeTo[w] = e;
            if (pq.contains(w)) 
            	pq.decreaseKey(w, distTo[w]);
            else                
            	pq.insert(w, distTo[w]);     
            //w is the index in pq, distTo[w] is the key in pq
            //deletemin will extract the min key value which is the shortes distance
        }
    }