Write statistics to file for graphs.