complted graph functionality(to be tested)