import pydot
import StringIO
import objgraph

a = 1
b = {"2": a, "3": a+1}
d = [a, b, [a, b], []]
dot = StringIO.StringIO()
objgraph.show_backrefs([d], output=dot)
graph = pydot.graph_from_dot_data(dot.getvalue())[0]
graph.write_pdf('graph.pdf')

