Stores the graph
Map < Integer , ArrayList < pair > > graph = new HashMap < > ( ) ; for ( int i = 0 ; i <= 6 ; i ++ ) graph . put ( i , new ArrayList < pair > ( ) ) ; graph . get ( 0 ) . add ( new pair ( 1 , 2 ) ) ; graph . get ( 0 ) . add ( new pair ( 2 , 3 ) ) ; graph . get ( 0 ) . add ( new pair ( 3 , 2 ) ) ; graph . get ( 1 ) . add ( new pair ( 4 , 4 ) ) ; graph . get ( 1 ) . add ( new pair ( 0 , 1 ) ) ; graph . get ( 2 ) . add ( new pair ( 4 , 5 ) ) ; graph . get ( 2 ) . add ( new pair ( 5 , 6 ) ) ; graph . get ( 3 ) . add ( new pair ( 5 , 7 ) ) ; graph . get ( 3 ) . add ( new pair ( 0 , 1 ) ) ; graph . get ( 4 ) . add ( new pair ( 6 , 4 ) ) ; graph . get ( 5 ) . add ( new pair ( 4 , 2 ) ) ; graph . get ( 6 ) . add ( new pair ( 7 , 11 ) ) ;