<｜begin▁of▁sentence｜>### Instruction:
Given a graph whose edge set is [(1, 2), (2, 3), (3, 4), (4, 1)], can you compute a 1-factor of this graph using NetworkX, and what are the edges of the 1-factor?
### Response:
import networkx as nx

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

# Compute a 1-factor of the graph
G2 = nx.k_factor(G, k=1)

print('Edges in the 1-factor:', list(G2.edges()))
<|EOT|>
