adjacency graph for tree
V = 8 NEW_LINE graph = [ [ ] for i in range ( V ) ] NEW_LINE graph [ 0 ] . append ( 1 ) NEW_LINE graph [ 0 ] . append ( 2 ) NEW_LINE graph [ 1 ] . append ( 3 ) NEW_LINE graph [ 1 ] . append ( 4 ) NEW_LINE graph [ 1 ] . append ( 5 ) NEW_LINE graph [ 2 ] . append ( 5 ) NEW_LINE graph [ 2 ] . append ( 6 ) NEW_LINE graph [ 6 ] . append ( 7 ) NEW_LINE