Effect of gas phase on graphitization of carbon