inverting graph