Add a reverse function that reverses all edges in the graph.