<｜begin▁of▁sentence｜>### Instruction:
Given a simple undirected path graph with nodes [0, 1, 2], how can you write this graph to a file in graph6 format including a header?
### Response:
import networkx as nx
import tempfile

G = nx.path_graph(3)

with tempfile.NamedTemporaryFile(delete=False) as f:
    nx.write_graph6(G, f.name, header=True)
    print('Graph has been written to', f.name)
<|EOT|>
