<｜begin▁of▁sentence｜>### Instruction:
Given a graph with edge set [(1, 2), (1, 3), (2, 3), (3, 4), (4, 5)], can you compute the diameter of the graph using NetworkX?
### Response:
import networkx as nx

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

# Use the diameter function
try:
    d = nx.diameter(G)
    print(f'The diameter of the graph is: {d}')
except nx.NetworkXError as e:
    print(e)
<|EOT|>
