Recurrence relation
for ( Pair < Pair < Integer , Integer > , Integer > it : ed ) dis1 [ it . first . second ] = Math . min ( dis1 [ it . first . second ] , dis [ it . first . first ] + it . second ) ; for ( int j = 0 ; j <= n ; j ++ ) dis [ j ] = dis1 [ j ] ; }