<｜begin▁of▁sentence｜>### Instruction:
Given a path graph with 4 nodes, can you write its adjacency list to a file using NetworkX?
### Response:
import networkx as nx

# Create a path graph with 4 nodes
G = nx.path_graph(4)

# Write the adjacency list to a file
nx.write_adjlist(G, 'test.adjlist')
<|EOT|>
