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