save graph to file