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 [ i ] . first ] [ v [ i ] . second ] = 1 ; adj [ v [ i ] . second ] [ v [ i ] . first ] = 1 ; }