Condition to check the distance is correct and update it if it is minimum from the previous computed distance
if ( alt < dist [ v ] ) { dist [ v ] = alt ; path [ v ] = current ; } } sett . remove ( current ) ; if ( sett . isEmpty ( ) ) break ;