print graph to file