Condition to check the distance is correct and update it if it is minimum from the previous computed distance
if ( alt < dist [ v ] ) : NEW_LINE INDENT dist [ v ] = alt ; NEW_LINE path [ v ] = current ; NEW_LINE DEDENT if current in sett : NEW_LINE sett . remove ( current ) ; NEW_LINE if ( len ( sett ) == 0 ) : NEW_LINE break ; NEW_LINE