working version of graph