If we find a connection to the sink node , then there is no point in BFS anymore We just have to set its parent and can return true
if ( v == t ) { parent [ v ] = u ; return true ; } q . push ( v ) ; parent [ v ] = u ; visited [ v ] = true ; } } }