changes to method write_c_code in class graph