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