cost graph creation