add graph code