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

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

# Write the edge list to a file
nx.write_edgelist(G, 'test.edgelist', data=True)
<|EOT|>
