Skip to the content.

:heavy_check_mark: library/graph/ReverseGraph.hpp

Depends on

Required by

Verified with

Code

#pragma once
template <typename GRAPH> GRAPH reverse_graph(const GRAPH &g) {
    GRAPH r(g.n);
    for (auto e : g.edges) {
        std::swap(e.from, e.to);
        r.add_arc(e);
    }
    r.build();
    return r;
}
#line 2 "library/graph/ReverseGraph.hpp"
template <typename GRAPH> GRAPH reverse_graph(const GRAPH &g) {
    GRAPH r(g.n);
    for (auto e : g.edges) {
        std::swap(e.from, e.to);
        r.add_arc(e);
    }
    r.build();
    return r;
}
Back to top page