<｜begin▁of▁sentence｜>### Instruction:
Given an undirected graph with edge set [(1, 2), (2, 3), (3, 4), (4, 1)], perform 5 double-edge swaps with a window threshold of 3 for connectedness check between swaps and a random seed of 42. How many successful swaps did occur?
### Response:
import networkx as nx

# Create a graph
G = nx.Graph()
G.add_edges_from([(1, 2), (2, 3), (3, 4), (4, 1)])

# Perform double-edge swaps
# Note: The actual number of successful swaps may be less than nswap
nswap = 5
window_threshold = 3
seed = 42

successful_swaps = nx.connected_double_edge_swap(G, nswap, _window_threshold=window_threshold, seed=seed)

print(f'Successful swaps: {successful_swaps}')
<|EOT|>
