adjacency graph for tree
int V = 8 ; List < List < int > > graph = new List < List < int > > ( ) ; for ( int i = 0 ; i < V + 1 ; i ++ ) graph . Add ( new List < int > ( ) ) ; graph [ 0 ] . Add ( 1 ) ; graph [ 0 ] . Add ( 2 ) ; graph [ 1 ] . Add ( 3 ) ; graph [ 1 ] . Add ( 4 ) ; graph [ 1 ] . Add ( 5 ) ; graph [ 2 ] . Add ( 5 ) ; graph [ 2 ] . Add ( 6 ) ; graph [ 6 ] . Add ( 7 ) ;