Add reverse_arcs function