adding graph manipulation code