modify the graph strucuture