A utility function to print the graph
public void printGraph ( ) { for ( int i = 0 ; i < v ; i ++ ) { System . out . println ( " Adjacency ▁ list ▁ of ▁ vertex ▁ " + i ) ; Iterator set = graph . get ( i ) . iterator ( ) ; while ( set . hasNext ( ) ) System . out . print ( set . next ( ) + " ▁ " ) ; System . out . println ( ) ; System . out . println ( ) ; } }