Adjacency list for graph
Vector < Integer > [ ] adj = new Vector [ V ] ; for ( int i = 0 ; i < V ; i ++ ) adj [ i ] = new Vector < Integer > ( ) ; adj [ 0 ] . add ( 1 ) ; adj [ 0 ] . add ( 2 ) ; adj [ 1 ] . add ( 2 ) ;