<｜begin▁of▁sentence｜>### Instruction:
Given an undirected graph whose edge set is [(1, 2), (2, 3), (3, 4), (4, 5), (5, 1)], can you compute the diameter of the graph using NetworkX, which is the maximum distance between any pair of nodes?
### Response:
import networkx as nx

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

# Compute the diameter of the graph
try:
    diameter = nx.diameter(G)
    print('Diameter of the graph:', diameter)
except nx.NetworkXError as e:
    print(e)
<|EOT|>
