Pairwise swap of nodes