added reversing a graph