getNodesToSwap implemented