add reverse method to graphs