<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_dotfile(G: nx.DiGraph, filename: str):
 """ Output a networkx graph to a DOT file. """

    A = to_agraph(G)
    A.write(filename)