update graph(need review)