graph class
class Graph { int vertices ; ArrayList < Integer > edge [ ] ; Graph ( int vertices ) { this . vertices = vertices ; edge = new ArrayList [ vertices + 1 ] ; for ( int i = 0 ; i <= vertices ; i ++ ) { edge [ i ] = new ArrayList < > ( ) ; } }