update graph alg