update graph. Still unfinished