Check for negative - weight cycles
C = - 1 ; NEW_LINE for i in range ( E ) : NEW_LINE INDENT u = graph . edge [ i ] . src ; NEW_LINE v = graph . edge [ i ] . dest ; NEW_LINE weight = graph . edge [ i ] . weight ; NEW_LINE if ( dist [ u ] != 1000000 and dist [ u ] + weight < dist [ v ] ) : NEW_LINE DEDENT