only add constraint if the two nodes are not already connected by their component id