Bellman ford algorithm
for ( int i = 0 ; i < n - 1 ; i ++ ) for ( Pair < Pair < Integer , Integer > , Float > it : ed ) dis [ it . first . second ] = Math . min ( dis [ it . first . second ] , dis [ it . first . first ] * it . second ) ;