updated the graph code to work in the new style