adding method in graph to reverse all of its edges