<｜begin▁of▁sentence｜>### Instruction:
Given an undirected graph with edges [(1, 2), (2, 3), (3, 4), (4, 1), (1, 3), (2, 4)], how can we randomize the graph while preserving each node's degree using NetworkX's double_edge_swap method?
### Response:
import networkx as nx

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

# Perform 10 double edge swaps
nx.double_edge_swap(G, nswap=10, max_tries=50)

print(G.edges())
<|EOT|>
