wrote code for graphs but untested