graph code updated