Connection swapping plus recording of connections for undo redo