update graph code