Loop through the edges to create adjacency list
for ( int i = 0 ; i < M ; i ++ ) { ( ( ArrayList ) adj [ sorc [ i ] ] ) . Add ( destination [ i ] ) ; ( ( ArrayList ) adj [ destination [ i ] ] ) . Add ( sorc [ i ] ) ; }