added graph code