Function to find the minimum edge cost having an end at the vertex i
int firstMin ( int adj [ N ] [ N ] , int i ) { int min = INT_MAX ; for ( int k = 0 ; k < N ; k ++ ) if ( adj [ i ] [ k ] < min && i != k ) min = adj [ i ] [ k ] ; return min ; }