Changed kcore to write graph only at end.