Writing graph to multiple files