<｜begin▁of▁sentence｜>### Instruction:
Given a graph with edge set [(1, 2), (2, 3), (3, 4)], demonstrate how to contract nodes 2 and 3 into a single node using NetworkX, and indicate the resulting graph's nodes and edges.
### Response:
import networkx as nx

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

# Contract nodes 2 and 3
H = nx.contracted_nodes(G, 2, 3, self_loops=False)

print('Nodes in H:', list(H.nodes()))
print('Edges in H:', list(H.edges()))
<|EOT|>
