Utility function to check if current vertex is already present in path
private static boolean isNotVisited ( int x , List < Integer > path ) { int size = path . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) if ( path . get ( i ) == x ) return false ; return true ; }