Now it works using GROUP by group_id and id.
sort0 := SORT(join0, group_id, id, level, number, node_id, new_node_id);
group0:= GROUP(sort0, group_id, id);
dedup0:= DEDUP(group0, LEFT.group_id = RIGHT.group_id AND LEFT.id = RIGHT.id AND LEFT.new_node_id != RIGHT.node_id, KEEP 1, LEFT);