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

# Create a path graph with 4 nodes
G = nx.path_graph(4)
# Write the graph to a Pajek file
nx.write_pajek(G, 'path_graph.net')
<|EOT|>
