first draft of graph implementation