working on graph data structure