<｜begin▁of▁sentence｜>### Instruction:
As an infectious disease specialist, I often encounter complex networks of transmission patterns for various infectious diseases. Today, I need to assess the impact of potential random network rewiring on disease transmission within a population. Specifically, I want to understand the implications of rewiring a network modeled on the Erdős-Rényi model with 10 vertices and 20 edges. I must also ensure that the rewiring process preserves the degree distribution, as this is crucial for maintaining the accuracy of transmission patterns within the population.
### Response:
from igraph import Graph

# Create a graph with some edges
g = Graph.Erdos_Renyi(n=10, m=20)

# Before rewiring
print('Before rewiring:')
print(g)

# Perform the rewiring
rewire_result = g.rewire(n=5)  # Rewire each edge 5 times

# After rewiring
print('After rewiring:')
print(g)
<|EOT|>
