<｜begin▁of▁sentence｜>### Instruction:
Given a complete graph generated with NetworkX (`K5 = nx.complete_graph(5)`), how can you convert this graph to a PyGraphviz AGraph object and then save it to a DOT format file?
### Response:
import networkx as nx
import pygraphviz as pgv

# Create a NetworkX graph
K5 = nx.complete_graph(5)

# Convert to a PyGraphviz graph
A = nx.nx_agraph.to_agraph(K5)

# It is now a PyGraphviz AGraph object and can be manipulated
# Print the graph as DOT script
print(A.to_string())

# Save the PyGraphviz graph to a file
A.write('k5.dot')
<|EOT|>
