Check for negative - weight cycles
int C = -1 ; for ( int i = 0 ; i < E ; i ++ ) { int u = graph -> edge [ i ] . src ; int v = graph -> edge [ i ] . dest ; int weight = graph -> edge [ i ] . weight ; if ( dist [ u ] != INT_MAX && dist [ u ] + weight < dist [ v ] ) {