NodeSet: avoid using same NodeSet instances in NodeSet.contiguous()

NodeSet.contiguous() generator could yield different NodeSet values
using the same NodeSet instance.
Doing some code cleaning in NodeSet._add(), and also added an assertion
in NodeSet._add_new() to check the documented precondition.