Writes graph to png