renamed apply method to graph becasue apply is python keyword