'Draw the graph and save it to a PNG file.'

def dbg_draw(self, filename):

    import matplotlib.pyplot as pyplot
    from networkx.drawing.nx_agraph import graphviz_layout
    tmp_graph = networkx.DiGraph()
    for (from_block, to_block) in self.transition_graph.edges():
        node_a = ('%#08x' % from_block.addr)
        node_b = ('%#08x' % to_block.addr)
        if (node_b in self._ret_sites):
            node_b += '[Ret]'
        if (node_a in self._call_sites):
            node_a += '[Call]'
        tmp_graph.add_edge(node_a, node_b)
    pos = graphviz_layout(tmp_graph, prog='fdp')
    networkx.draw(tmp_graph, pos, node_size=1200)
    pyplot.savefig(filename)
