As the graph is undirected so there will be an edge between ( i , j ) and ( j , i )
for ( int i = 0 ; i < v . size ( ) ; i ++ ) { adj [ v . elementAt ( i ) . first ] [ v . elementAt ( i ) . second ] = 1 ; adj [ v . elementAt ( i ) . second ] [ v . elementAt ( i ) . first ] = 1 ; }