modifying definition of graph