change graph data structure