def persist_graph(G, output_file):
    """Plots the graph and persists it into a file. Uses graphviz (needs to
    be installed!)."""
    import networkx as nx
    A = nx.nx_agraph.to_agraph(G)
    A.layout('dot', args=
        '-Goverlap=false -Gsplines=true -Gconcentrate=true -Gfontname=typewriter'
        )
    A.draw(output_file)
