Ahhhh now I understand what you mean.
is_neighbour is set to false by default in min and true by default in max and you basically have to set it to false in max and true in min in the conditions.