Traverse the matrix to create adjacency list
for ( int i = 0 ; i < mat . GetLength ( 0 ) ; i ++ ) { for ( int j = 0 ; j < mat . GetLength ( 0 ) ; j ++ ) { if ( mat [ i , j ] == 1 ) { Adj [ i ] . Add ( j ) ; } } }