Utility function to calculate trace of a matrix ( sum ofdiagnonal elements )
int getTrace ( int [ , ] graph ) { int trace = 0 ; for ( int i = 0 ; i < V ; i ++ ) { trace += graph [ i , i ] ; } return trace ; }