function writeGraph





