creating graph structure